From: Joshua Hahn <joshua.hahnjy@gmail.com>
To: "Gregory Price (Meta)" <gourry@gourry.net>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
kernel-team@meta.com, akpm@linux-foundation.org,
david@kernel.org, ziy@nvidia.com, rakie.kim@sk.com,
ying.huang@linux.alibaba.com
Subject: Re: [PATCH] mm/mempolicy: ignore a bind policy whose nodes have no memory
Date: Fri, 13 Nov 2026 16:03:24 -0800 [thread overview]
Message-ID: <avelG_Yo_-3ClgPS@devbig011.atn3.facebook.com> (raw)
In-Reply-To: <20261113192642.2618878-1-gourry@gourry.net>
On Fri, Nov 13, 2026 at 02:26:42PM -0500, Gregory Price (Meta) wrote:
> apply_policy_zone() assumes that policy->nodes intersects N_MEMORY, so
> it reads a bind policy with no N_HIGH_MEMORY node as movable-only.
>
> On systems with CONFIG_CPUSETS=n, nothing rebinds policies when memory
> is removed, so offlining all memory on the nodes a bind policy names
> leaves it with none. The policy is then treated as movable-only, and
> movable allocations are restricted to nodes without memory.
>
> This results in allocations failures, a VM_FAULT_OOM leak, and then
> an infinitely retrying fault that hangs the process.
>
> page allocation failure: order:0, mode:0x140dca ... nodemask=2
> Huh VM_FAULT_OOM leaked out to the #PF handler. Retrying PF
>
> Ignore a bind policy whose nodes have no memory. policy_nodemask()
> already ignores a bind policy that does not intersect the cpuset.
> This covers hugetlb's policy_mbind_nodemask() as well.
>
> If the nodes regain memory, the policy applies again.
>
> CPUSETS=n with HOTREMOVE=y is unlikely a common configuration, so this
> isn't marked for stable.
>
> Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
Hello Gregory,
Cool find! Thanks for fixing this.
Reviewed-by: Joshua Hahn <joshua.hahnjy@gmail.com>
> ---
> mm/mempolicy.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/mm/mempolicy.c b/mm/mempolicy.c
> index ca7e744727b1..5dc2d7ef1544 100644
> --- a/mm/mempolicy.c
> +++ b/mm/mempolicy.c
> @@ -2096,6 +2096,10 @@ bool apply_policy_zone(struct mempolicy *policy, enum zone_type zone)
>
> BUG_ON(dynamic_policy_zone == ZONE_MOVABLE);
>
> + /* Memory hot-remove can leave policy->nodes without memory. */
> + if (!nodes_intersects(policy->nodes, node_states[N_MEMORY]))
> + return false;
> +
> /*
> * if policy->nodes has movable memory only,
> * we apply policy when gfp_zone(gfp) = ZONE_MOVABLE only.
> --
> 2.56.0
>
next prev parent reply other threads:[~2026-11-14 0:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 19:26 [PATCH] mm/mempolicy: ignore a bind policy whose nodes have no memory Gregory Price (Meta)
2026-11-13 19:47 ` Zi Yan
2026-11-13 20:14 ` Gregory Price (Meta)
2026-11-13 20:16 ` Zi Yan
2026-11-14 0:03 ` Joshua Hahn [this message]
2026-11-14 1:14 ` SJ Park
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=avelG_Yo_-3ClgPS@devbig011.atn3.facebook.com \
--to=joshua.hahnjy@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=gourry@gourry.net \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rakie.kim@sk.com \
--cc=ying.huang@linux.alibaba.com \
--cc=ziy@nvidia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.