From: Andrew Morton <akpm@linux-foundation.org>
To: Farhad Alemi <farhad.alemi@berkeley.edu>
Cc: Waiman Long <longman@redhat.com>, Farhad Alemi <falemi@asu.edu>,
David Hildenbrand <david@kernel.org>,
Gregory Price <gourry@gourry.net>, Yury Norov <ynorov@nvidia.com>,
Joshua Hahn <joshua.hahnjy@gmail.com>, Zi Yan <ziy@nvidia.com>,
Matthew Brost <matthew.brost@intel.com>,
Rakie Kim <rakie.kim@sk.com>, Byungchul Park <byungchul@sk.com>,
Ying Huang <ying.huang@linux.alibaba.com>,
Alistair Popple <apopple@nvidia.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
cgroups@vger.kernel.org, stable@vger.kernel.org,
Tejun Heo <tj@kernel.org>
Subject: Re: [PATCH v2] cgroup/cpuset: rebind mm mempolicy to effective_mems, not mems_allowed
Date: Sat, 27 Jun 2026 23:15:08 -0700 [thread overview]
Message-ID: <20260627231508.74201ca47c883507be97d8c2@linux-foundation.org> (raw)
In-Reply-To: <CA+0ovCgfHJHv5d1mzapWWvF-LhjppzDX8NPPLvCPZxPKg8RiYw@mail.gmail.com>
On Sun, 14 Jun 2026 06:25:55 -0700 Farhad Alemi <farhad.alemi@berkeley.edu> wrote:
> Creating a child cpuset where cpuset.mems is never set leads to a div/0
> when a VMA mempolicy with MPOL_F_RELATIVE_NODES rebinds in response to a
> CPU hotplug event.
>
> Reproduction steps:
> 1) Create a cgroup w/ cpuset controls (do not set cpuset.mems)
> 2) Move the task into the child cpuset
> 3) Create a VMA mempolicy for that task with MPOL_F_RELATIVE_NODES
> 4) unplug and hotplug a cpu
> echo 0 > /sys/devices/system/cpu/cpu1/online
> echo 1 > /sys/devices/system/cpu/cpu1/online
> 5) mempolicy rebind does a div/0 in mpol_relative_nodemask on the
> call to __nodes_fold()
Oops.
> The cpuset code passes (cs->mems_allowed) which is not guaranteed to have
> nodes to the rebind routine. Use cs->effective_mems instead, which is
> guaranteed to have a non-empty nodemask.
Well gee, what happened with this patch.
I apologize for misfiling a cc:stable bugfix into my post-rc1 backlog
pile, but I got there in the end.
I guess this is an MM patch, even though it's against
kernel/cgroup/cpuset.c.
Nobody cc'ed Tejun. Fixed.
David acked v1 but is being coy about the v2 patch?
Sashiko AI review suggests that there's a similar bug in
sys_set_mempolicy():
https://sashiko.dev/#/patchset/CA+0ovCgfHJHv5d1mzapWWvF-LhjppzDX8NPPLvCPZxPKg8RiYw@mail.gmail.com
Anyway, I'll queue the v2 patch as an mm.git hotfix, but not with a lot
of confidence at this time. Can people please refocus on this and help
recommend a way forward?
From: Farhad Alemi <farhad.alemi@berkeley.edu>
Subject: cgroup/cpuset: rebind mm mempolicy to effective_mems, not mems_allowed
Date: Sun, 14 Jun 2026 06:25:55 -0700
Creating a child cpuset where cpuset.mems is never set leads to a div/0
when a VMA mempolicy with MPOL_F_RELATIVE_NODES rebinds in response to a
CPU hotplug event.
Reproduction steps:
1) Create a cgroup w/ cpuset controls (do not set cpuset.mems)
2) Move the task into the child cpuset
3) Create a VMA mempolicy for that task with MPOL_F_RELATIVE_NODES
4) unplug and hotplug a cpu
echo 0 > /sys/devices/system/cpu/cpu1/online
echo 1 > /sys/devices/system/cpu/cpu1/online
5) mempolicy rebind does a div/0 in mpol_relative_nodemask on the
call to __nodes_fold()
The cpuset code passes (cs->mems_allowed) which is not guaranteed to have
nodes to the rebind routine. Use cs->effective_mems instead, which is
guaranteed to have a non-empty nodemask.
Link: https://lore.kernel.org/linux-mm/CA+0ovCgxbZkXa+OU8w3s84R3KNPNxxRfmsNR-udh+afQBbGNmw@mail.gmail.com/
Link: https://lore.kernel.org/all/CA+0ovCiEz6SP_sn3kN4Tb+_oC=eHMXy_Ffj=usV3wREdQrUtww@mail.gmail.com/
Link: https://lore.kernel.org/CA+0ovCgfHJHv5d1mzapWWvF-LhjppzDX8NPPLvCPZxPKg8RiYw@mail.gmail.com
Fixes: ae1c802382f7 ("cpuset: apply cs->effective_{cpus,mems}")
Signed-off-by: Farhad Alemi <farhad.alemi@berkeley.edu>
Suggested-by: Gregory Price <gourry@gourry.net>
Suggested-by: Waiman Long <longman@redhat.com>
Closes: https://lore.kernel.org/linux-mm/CA+0ovCgxbZkXa+OU8w3s84R3KNPNxxRfmsNR-udh+afQBbGNmw@mail.gmail.com/
Acked-by: Waiman Long <longman@redhat.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Byungchul Park <byungchul@sk.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: Gregory Price <gourry@gourry.net>
Cc: "Huang, Ying" <ying.huang@linux.alibaba.com>
Cc: Joshua Hahn <joshua.hahnjy@gmail.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Rakie Kim <rakie.kim@sk.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
kernel/cgroup/cpuset.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/kernel/cgroup/cpuset.c~cgroup-cpuset-rebind-mm-mempolicy-to-effective_mems-not-mems_allowed
+++ a/kernel/cgroup/cpuset.c
@@ -2653,7 +2653,7 @@ void cpuset_update_tasks_nodemask(struct
migrate = is_memory_migrate(cs);
- mpol_rebind_mm(mm, &cs->mems_allowed);
+ mpol_rebind_mm(mm, &cs->effective_mems);
if (migrate)
cpuset_migrate_mm(mm, &cs->old_mems_allowed, &newmems);
else
_
next prev parent reply other threads:[~2026-06-28 6:15 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-28 19:03 [PATCH] mm: don't allow empty relative nodemask in mpol_relative_nodemask() Yury Norov
2026-05-28 19:37 ` Waiman Long
2026-05-28 19:40 ` Yury Norov
2026-05-28 19:37 ` Matthew Wilcox
2026-05-28 19:41 ` Andrew Morton
2026-05-29 15:26 ` Joshua Hahn
2026-05-29 17:47 ` Yury Norov
2026-05-29 18:40 ` Joshua Hahn
2026-06-01 14:32 ` David Hildenbrand (Arm)
2026-06-02 8:44 ` Gregory Price
2026-06-02 9:19 ` David Hildenbrand (Arm)
2026-06-02 9:54 ` Gregory Price
2026-06-02 15:01 ` Farhad Alemi
2026-06-05 15:18 ` David Hildenbrand (Arm)
2026-06-09 23:57 ` [PATCH] cgroup/cpuset: rebind mm mempolicy to effective_mems, not mems_allowed Farhad Alemi
2026-06-10 0:53 ` Andrew Morton
2026-06-10 11:34 ` Gregory Price
2026-06-11 2:50 ` Waiman Long
2026-06-14 13:25 ` [PATCH v2] " Farhad Alemi
2026-06-15 8:08 ` David Hildenbrand (Arm)
2026-06-15 9:38 ` Gregory Price
2026-06-15 11:08 ` David Hildenbrand (Arm)
2026-06-15 11:19 ` Gregory Price
2026-06-15 11:39 ` David Hildenbrand (Arm)
2026-06-16 2:26 ` Waiman Long
2026-06-16 3:43 ` Waiman Long
2026-06-16 6:59 ` David Hildenbrand (Arm)
2026-06-16 13:44 ` Gregory Price
2026-06-16 15:27 ` Waiman Long
2026-06-16 15:23 ` Waiman Long
2026-06-18 8:41 ` David Hildenbrand (Arm)
2026-06-21 3:24 ` Waiman Long
2026-06-22 7:12 ` David Hildenbrand (Arm)
2026-06-16 3:44 ` Waiman Long
2026-06-28 6:15 ` Andrew Morton [this message]
2026-06-29 7:27 ` David Hildenbrand (Arm)
2026-05-29 8:47 ` [PATCH] mm: don't allow empty relative nodemask in mpol_relative_nodemask() kernel test robot
2026-05-29 8:58 ` kernel test robot
2026-05-29 12:45 ` kernel test robot
2026-05-29 12:47 ` kernel test robot
2026-06-01 14:06 ` David Hildenbrand (Arm)
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=20260627231508.74201ca47c883507be97d8c2@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=apopple@nvidia.com \
--cc=byungchul@sk.com \
--cc=cgroups@vger.kernel.org \
--cc=david@kernel.org \
--cc=falemi@asu.edu \
--cc=farhad.alemi@berkeley.edu \
--cc=gourry@gourry.net \
--cc=joshua.hahnjy@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@rasmusvillemoes.dk \
--cc=longman@redhat.com \
--cc=matthew.brost@intel.com \
--cc=rakie.kim@sk.com \
--cc=stable@vger.kernel.org \
--cc=tj@kernel.org \
--cc=ying.huang@linux.alibaba.com \
--cc=ynorov@nvidia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox