[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2906e2b7-cc89-4d1b-893a-c20e4f100f97@huaweicloud.com>
Date: Mon, 22 Dec 2025 16:28:51 +0800
From: Chen Ridong <chenridong@...weicloud.com>
To: Bing Jiao <bingjiao@...gle.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org, stable@...r.kernel.org,
akpm@...ux-foundation.org, gourry@...rry.net, longman@...hat.com,
hannes@...xchg.org, mhocko@...nel.org, roman.gushchin@...ux.dev,
shakeel.butt@...ux.dev, muchun.song@...ux.dev, tj@...nel.org,
mkoutny@...e.com, david@...nel.org, zhengqi.arch@...edance.com,
lorenzo.stoakes@...cle.com, axelrasmussen@...gle.com, yuanchu@...gle.com,
weixugc@...gle.com, cgroups@...r.kernel.org
Subject: Re: [PATCH v2 2/2] mm/vmscan: check all allowed targets in
can_demote()
On 2025/12/22 14:09, Bing Jiao wrote:
> On Mon, Dec 22, 2025 at 10:51:49AM +0800, Chen Ridong wrote:
>>
>>
>> On 2025/12/22 7:36, Bing Jiao wrote:
>>> -void cpuset_node_filter_allowed(struct cgroup *cgroup, nodemask_t *mask)
>>> -{
>>> - struct cgroup_subsys_state *css;
>>> - struct cpuset *cs;
>>> -
>>> - if (!cpuset_v2())
>>> - return;
>>> -
>>> - css = cgroup_get_e_css(cgroup, &cpuset_cgrp_subsys);
>>> - if (!css)
>>> - return;
>>> -
>>> - /* Follows the same assumption in cpuset_node_allowed() */
>>> - cs = container_of(css, struct cpuset, css);
>>> nodes_and(*mask, *mask, cs->effective_mems);
>>> css_put(css);
>>> }
>>
>> Oh, I see you merged these two functions here.
>>
>> However, I think cpuset_get_mem_allowed would be more versatile in general use.
>>
>> You can then check whether the returned nodemask intersects with your target mask. In the future,
>> there may be scenarios where users simply want to retrieve the effective masks directly.
>>
>
> Hi Ridong, thank you for the suggestions.
>
> I agree that returning a nodemask would provide greater versatility.
>
> I think cpuset_get_mem_allowed_relax() would be a better name,
> since we do not need the locking and online mem guarantees
> compared to an similar function cpuset_mems_allowed().
>
I think the key difference between cpuset_mems_allowed and the helper you intend to implement lies
not in locking or online memory guarantees, but in the input parameter: you want to retrieve
cpuset->effective_mems for a cgroup from another subsystem.
The cs->effective_mems should typically only include online nodes, except during brief transitional
periods such as hotplug operations. Similarly, node migration logic also requires online nodes.
Therefore, cpuset_get_mem_allowed seems acceptable to me.
Additionally, you may consider calling guarantee_online_mems inside your new helper to ensure
consistency.
--
Best regards,
Ridong
Powered by blists - more mailing lists