From: Waiman Long <longman@redhat.com>
To: Gregory Price <gourry@gourry.net>,
"David Hildenbrand (Arm)" <david@kernel.org>
Cc: Farhad Alemi <farhad.alemi@berkeley.edu>,
Andrew Morton <akpm@linux-foundation.org>,
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>,
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 v2] cgroup/cpuset: rebind mm mempolicy to effective_mems, not mems_allowed
Date: Mon, 15 Jun 2026 23:43:26 -0400 [thread overview]
Message-ID: <c1495b1b-9dee-4cd5-ac8e-eeb7a2d968ed@redhat.com> (raw)
In-Reply-To: <70f486ce-5ef6-4d72-8cc3-7086f4eea930@redhat.com>
On 6/15/26 10:26 PM, Waiman Long wrote:
>
> On 6/15/26 5:38 AM, Gregory Price wrote:
>> On Mon, Jun 15, 2026 at 10:08:51AM +0200, David Hildenbrand (Arm) wrote:
>>> On 6/14/26 15:25, Farhad Alemi wrote:
>>>> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
>>>> --- a/kernel/cgroup/cpuset.c
>>>> +++ b/kernel/cgroup/cpuset.c
>>>> @@ -2649,7 +2649,7 @@ void cpuset_update_tasks_nodemask(struct
>>>> cpuset *cs)
>>>>
>>>> migrate = is_memory_migrate(cs);
>>>>
>>>> - mpol_rebind_mm(mm, &cs->mems_allowed);
>>>> + mpol_rebind_mm(mm, &cs->effective_mems);
>>> God this is confusing.
>>>
>> All interactions between mempolicy and cpuset are horrible and
>> confusing. Much like Lorenzo's anon_vma work, I have to keep
>> notes on how this whole thing doesn't just spew SIGBUS constantly.
>>
>> The short answer is: mempolicy is advisory and cpuset is strictly
>> followed - in a dispute cpuset wins... except for file backed memory,
>> then everyon loses and nothing is consistent.
>
> That is what I believe why mpol_rebind_mm() a bit differently from the
> others and it is historically done this way a long time ago before
> cgroup v2.
>
> For cgroup v1, mems_allowed can't be empty or you can't put any task
> into the cpuset. Also effective_mems is the same as mems_allowed.
> cgroup v2 is quite different in how it handles memory nodes and CPUs.
> Users can isn't forced to set mems_allowed and cpus_allowed as
> effective_mems and effective_cpus will inherit parent version if
> mems_allowed and cpus_allowed are not set. IOW, effective_mems will
> never be empty. Yes, it is a bug with the introduction of cpuset v2
> that we should have replaced mems_allowed by effective_mems at that
> time. With v2, effective_mems should contain only online nodes. The
> only exception is during the short transition period when a memory
> node hotunplug operation is in progress when a write to cpuset.mems is
> happening at the same time. With v1, it is theoretically possible that
> none of the nodes in mems_allowed is online.
>
> The reason why I am suggesting to use cs->effective_mems to keep the
> old cgroup v1 behavior. If the consensus is to use the output of
> guarantee_online_mems() for mpol_rebind_mm(), I will not be against
> that but it will be a slight change in user-visible behavior.
BTW, I still prefer the v2 patch. If it is decided we should use the
guarantee_online_mems() value instead, it will have to be a separate
patch with changes in the relevant documentation like
Documentation/admin-guide/cgroup-v1/cpuset.rst.
Cheers,
Longman
next prev parent reply other threads:[~2026-06-16 3:43 UTC|newest]
Thread overview: 36+ 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 [this message]
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-16 3:44 ` Waiman Long
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=c1495b1b-9dee-4cd5-ac8e-eeb7a2d968ed@redhat.com \
--to=longman@redhat.com \
--cc=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=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