Re: [PATCH] mm/hugetlb: add dedicated func to get 'allowed' nodemask for current process

From: Feng Tang
Date: Thu Aug 04 2022 - 20:07:28 EST


On Fri, Aug 05, 2022 at 06:37:17AM +0800, Andrew Morton wrote:
> On Thu, 4 Aug 2022 15:36:48 +0200 Michal Hocko <mhocko@xxxxxxxx> wrote:
>
> > On Thu 04-08-22 21:03:42, Feng Tang wrote:
> > > Muchun Song found that after MPOL_PREFERRED_MANY policy was introduced
> > > in commit b27abaccf8e8 ("mm/mempolicy: add MPOL_PREFERRED_MANY for multiple preferred nodes")
> > > [1], the policy_nodemask_current()'s semantics for this new policy
> > > has been changed, which returns 'preferred' nodes instead of 'allowed'
> > > nodes, and could hurt the usage of its caller in hugetlb:
> > > allowed_mems_nr().
> >
> > The acutal user visible effect description is missing here. AFAIU it
> > would be this.
> >
> > With the changed semantic of policy_nodemask_current a taks with
> > MPOL_PREFERRED_MANY policy could fail to get its reservation even though
> > it can fall back to other nodes (either defined by cpusets or all online
> > nodes) for that reservation failing mmap calles unnecessarily early.
> >
> > The fix is to not consider MPOL_PREFERRED_MANY for reservations at all
> > because they, unlike MPOL_MBIND, do not pose any actual hard constrain.
>
> And is this Fixes: b27abaccf8e8 ("mm/mempolicy: add MPOL_PREFERRED_MANY
> for multiple preferred nodes")?

Yes. Will add it in the next version, thanks.

- Feng