linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Muchun Song <songmuchun@bytedance.com>
To: Feng Tang <feng.tang@intel.com>
Cc: Andrew Morton <akpm@linux-founddation.org>,
	Mike Kravetz <mike.kravetz@oracle.com>,
	Michal Hocko <mhocko@suse.com>,
	Dave Hansen <dave.hansen@intel.com>,
	Ben Widawsky <bwidawsk@kernel.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mm/hugetlb: add dedicated func to get 'allowed' nodemask for current process
Date: Fri, 5 Aug 2022 10:44:35 +0800	[thread overview]
Message-ID: <YuyEE3ag0/0iixo6@FVFYT0MHHV2J.usts.net> (raw)
In-Reply-To: <20220805005903.95563-1-feng.tang@intel.com>

On Fri, Aug 05, 2022 at 08:59:03AM +0800, 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"),
> the policy_nodemask_current()'s semantics for this new policy has been
> changed, which returns 'preferred' nodes instead of 'allowed' nodes.
> 
> With the changed semantic of policy_nodemask_current, a task 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.
> 
> Michal suggested the policy_nodemask_current() is only used by hugetlb,
> and could be moved to hugetlb code with more explicit name to enforce
> the 'allowed' semantics for which only MPOL_BIND policy matters.
> 
> apply_policy_zone() is made extern to be called in hugetlb code
> and its return value is changed to bool.
> 
> [1]. https://lore.kernel.org/lkml/20220801084207.39086-1-songmuchun@bytedance.com/t/
> 
> Fixes: b27abaccf8e8 ("mm/mempolicy: add MPOL_PREFERRED_MANY for multiple preferred nodes")
> Reported-by: Muchun Song <songmuchun@bytedance.com>
> Suggested-by: Michal Hocko <mhocko@suse.com>
> Signed-off-by: Feng Tang <feng.tang@intel.com>
> Acked-by: Michal Hocko <mhocko@suse.com>

Thanks for fixing this.

Reviewed-by: Muchun Song <songmuchun@bytedance.com>



      reply	other threads:[~2022-08-05  2:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-05  0:59 Feng Tang
2022-08-05  2:44 ` Muchun Song [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YuyEE3ag0/0iixo6@FVFYT0MHHV2J.usts.net \
    --to=songmuchun@bytedance.com \
    --cc=akpm@linux-founddation.org \
    --cc=bwidawsk@kernel.org \
    --cc=dave.hansen@intel.com \
    --cc=feng.tang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=mike.kravetz@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox