Re: [RFC] autonuma: Migrate on fault among multiple bound nodes

From: Huang, Ying
Date: Wed Sep 16 2020 - 22:25:20 EST


peterz@xxxxxxxxxxxxx writes:

> On Wed, Sep 16, 2020 at 08:59:36AM +0800, Huang Ying wrote:
>> +static bool mpol_may_mof(struct mempolicy *pol)
>> +{
>> + /* May migrate among bound nodes for MPOL_BIND */
>> + return pol->flags & MPOL_F_MOF ||
>> + (pol->mode == MPOL_BIND && nodes_weight(pol->v.nodes) > 1);
>> +}
>
> This is weird, why not just set F_MOF on the policy?
>
> In fact, why wouldn't something like:
>
> mbind(.mode=MPOL_BIND, .flags=MPOL_MF_LAZY);
>
> work today? Afaict MF_LAZY will unconditionally result in M_MOF.

Another question.

This means for all VMAs that are mbind() without MPOL_MF_LAZY and tasks
which binds memory via set_mempolicy(), we will not try to optimize
their page placement among the bound nodes even if sysctl knob
kernel.numa_balancing is enabled.

Is this the intended behavior? Although we enable AutoNUMA globally, we
will not try to use it in any places if possible. In some places, it
needs to be enabled again.

Best Regards,
Huang, Ying