From: Andrew Morton <akpm@linux-foundation.org>
To: Farhad Alemi <farhad.alemi@berkeley.edu>
Cc: David Hildenbrand <david@kernel.org>,
Gregory Price <gourry@gourry.net>, Farhad Alemi <falemi@asu.edu>,
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>,
Waiman Long <longman@redhat.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
cgroups@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] cgroup/cpuset: rebind mm mempolicy to effective_mems, not mems_allowed
Date: Tue, 9 Jun 2026 17:53:47 -0700 [thread overview]
Message-ID: <20260609175347.9688ac8060bc072ebd58cbe1@linux-foundation.org> (raw)
In-Reply-To: <CA+0ovCg05rUk1-3k2ysdxmbcER8aG-wVh9SSTrrbp6LPWpPHYA@mail.gmail.com>
On Tue, 9 Jun 2026 19:57:41 -0400 Farhad Alemi <farhad.alemi@berkeley.edu> wrote:
> cpuset_update_tasks_nodemask() rebinds a task's own mempolicy to the
> cpuset's effective, online mems (newmems, from guarantee_online_mems()),
> but rebinds that task's VMA mempolicies to the *configured* mask instead:
Hard to understand. Was "rebinds" supposed to be "is supposed to
rebind"?
> cpuset_change_task_nodemask(task, &newmems);
> ...
> mpol_rebind_mm(mm, &cs->mems_allowed);
>
> On the default (v2) hierarchy a cpuset that has never had cpuset.mems
> written keeps mems_allowed empty while effective_mems is inherited
> non-empty from the parent, and tasks may be attached to it (the
> empty-mems attach check is v1-only). A subsequent rebind -- e.g. from a
> CPU hotplug event walking the cpuset -- then calls mpol_rebind_mm() with
> an empty mask. For a VMA policy created with MPOL_F_RELATIVE_NODES this
> reaches mpol_relative_nodemask() ->
> nodes_fold(..., nodes_weight(cs->mems_allowed) == 0) -> bitmap_fold(),
> whose set_bit(oldbit % sz, dst) divides by zero:
>
> Oops: divide error: 0000 [#1] SMP KASAN NOPTI
> RIP: 0010:bitmap_fold+0x5e/0xb0
> mpol_rebind_nodemask
> mpol_rebind_mm
> cpuset_update_tasks_nodemask
> cpuset_handle_hotplug
> sched_cpu_deactivate
> cpuhp_thread_fun
>
> cs->mems_allowed is the only nodemask in this function that is not the
> effective set: the task-policy rebind, the page-migration target and
> cs->old_mems_allowed all use newmems. The sibling cpuset_attach() path
> already rebinds VMA policies against the effective mems
> (cpuset_attach_nodemask_to = cs->effective_mems) and explicitly notes
> that mems_allowed can be empty under hotplug. Rebind the VMA policies to
> newmems too: it is guaranteed non-empty by guarantee_online_mems(), which
> fixes the divide-by-zero, and it makes the VMA policies consistent with
> the task policy and with the nodes the task is actually allowed to use.
How is this bug triggered?
next prev parent reply other threads:[~2026-06-10 0:53 UTC|newest]
Thread overview: 29+ 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 [this message]
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-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=20260609175347.9688ac8060bc072ebd58cbe1@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=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