[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <19e268b0-b6d5-4aab-a4d0-cd1102027f3d@redhat.com>
Date: Fri, 18 Apr 2025 23:53:26 -0400
From: Waiman Long <llong@...hat.com>
To: Gregory Price <gourry@...rry.net>, Waiman Long <llong@...hat.com>
Cc: cgroups@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, kernel-team@...a.com, tj@...nel.org,
hannes@...xchg.org, mkoutny@...e.com, mhocko@...nel.org,
roman.gushchin@...ux.dev, shakeel.butt@...ux.dev, muchun.song@...ux.dev,
akpm@...ux-foundation.org
Subject: Re: [PATCH v2 2/2] vmscan,cgroup: apply mems_effective to reclaim
On 4/18/25 11:47 PM, Gregory Price wrote:
> On Fri, Apr 18, 2025 at 10:06:40PM -0400, Waiman Long wrote:
>>> +bool cpuset_node_allowed(struct cgroup *cgroup, int nid)
>>> +{
>>> + struct cgroup_subsys_state *css;
>>> + unsigned long flags;
>>> + struct cpuset *cs;
>>> + bool allowed;
>>> +
>>> + css = cgroup_get_e_css(cgroup, &cpuset_cgrp_subsys);
>>> + if (!css)
>>> + return true;
>>> +
>>> + cs = container_of(css, struct cpuset, css);
>>> + spin_lock_irqsave(&callback_lock, flags);
>>> + /* At least one parent must have a valid node list */
>>> + while (nodes_empty(cs->effective_mems))
>>> + cs = parent_cs(cs);
>> For cgroup v2, effective_mems should always be set and walking up the tree
>> isn't necessary. For v1, it can be empty, but memory cgroup and cpuset are
>> unlikely in the same hierarchy.
>>
> Hm, do i need different paths here for v1 vs v2 then? Or is it
> sufficient to simply return true if effective_mems is empty (which
> implies v1)?
Yes, you can return true if it happens to be empty, but it is
"unlikely". In v1,cpuset and memory cgroup are in separate hierarchies
AFAIU. So the cgroup you pass into cpuset_node_allowed() won't have a
matching cpuset.
Cheers,
Longman
> Thanks,
> ~Gregory
>
Powered by blists - more mailing lists