linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Chen Ridong <chenridong@huaweicloud.com>
To: "Waiman Long" <llong@redhat.com>,
	"Yury Norov" <ynorov@nvidia.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Alistair Popple" <apopple@nvidia.com>,
	"Byungchul Park" <byungchul@sk.com>,
	"David Hildenbrand" <david@kernel.org>,
	"Gregory Price" <gourry@gourry.net>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"Joshua Hahn" <joshua.hahnjy@gmail.com>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	"Lorenzo Stoakes" <lorenzo.stoakes@oracle.com>,
	"Matthew Brost" <matthew.brost@intel.com>,
	"Michal Hocko" <mhocko@suse.com>,
	"Michal Koutný" <mkoutny@suse.com>,
	"Mike Rapoport" <rppt@kernel.org>, "Rakie Kim" <rakie.kim@sk.com>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Tejun Heo" <tj@kernel.org>, "Vlastimil Babka" <vbabka@suse.cz>,
	"Ying Huang" <ying.huang@linux.alibaba.com>,
	"Zi Yan" <ziy@nvidia.com>,
	cgroups@vger.kernel.org
Cc: Yury Norov <yury.norov@gmail.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] cgroup: use nodes_and() output where appropriate
Date: Thu, 15 Jan 2026 08:52:50 +0800	[thread overview]
Message-ID: <2e8bf48a-b819-40b9-bb9b-f6ac6672059a@huaweicloud.com> (raw)
In-Reply-To: <51675d7c-5c9d-4596-8e5c-692c90b79e06@redhat.com>



On 2026/1/15 6:33, Waiman Long wrote:
> On 1/14/26 12:22 PM, Yury Norov wrote:
>> Now that nodes_and() returns true if the result nodemask is not empty,
>> drop useless nodes_intersects() in guarantee_online_mems() and
>> nodes_empty() in update_nodemasks_hier(), which both are O(N).
>>
>> Signed-off-by: Yury Norov <ynorov@nvidia.com>
>> ---
>>   kernel/cgroup/cpuset.c | 7 +++----
>>   1 file changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
>> index 3e8cc34d8d50..e962efbb300d 100644
>> --- a/kernel/cgroup/cpuset.c
>> +++ b/kernel/cgroup/cpuset.c
>> @@ -456,9 +456,8 @@ static void guarantee_active_cpus(struct task_struct *tsk,
>>    */
>>   static void guarantee_online_mems(struct cpuset *cs, nodemask_t *pmask)
>>   {
>> -    while (!nodes_intersects(cs->effective_mems, node_states[N_MEMORY]))
>> +    while (!nodes_and(*pmask, cs->effective_mems, node_states[N_MEMORY]))
>>           cs = parent_cs(cs);
>> -    nodes_and(*pmask, cs->effective_mems, node_states[N_MEMORY]);
>>   }
>>     /**
>> @@ -2862,13 +2861,13 @@ static void update_nodemasks_hier(struct cpuset *cs, nodemask_t *new_mems)
>>       cpuset_for_each_descendant_pre(cp, pos_css, cs) {
>>           struct cpuset *parent = parent_cs(cp);
>>   -        nodes_and(*new_mems, cp->mems_allowed, parent->effective_mems);
>> +        bool has_mems = nodes_and(*new_mems, cp->mems_allowed, parent->effective_mems);
>>             /*
>>            * If it becomes empty, inherit the effective mask of the
>>            * parent, which is guaranteed to have some MEMs.
>>            */
>> -        if (is_in_v2_mode() && nodes_empty(*new_mems))
>> +        if (is_in_v2_mode() && !has_mems)
>>               *new_mems = parent->effective_mems;
>>             /* Skip the whole subtree if the nodemask remains the same. */
> Reviewed-by: Waiman Long <longman@redhat.com>
> 

Reviewed-by: Chen Ridong <chenridong@huaweicloud.com>

-- 
Best regards,
Ridong



  reply	other threads:[~2026-01-15  0:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-14 17:22 [PATCH 0/3] nodemask: align nodes_and{,not} with underlying bitmap ops Yury Norov
2026-01-14 17:22 ` [PATCH 1/3] nodemask: propagate boolean for nodes_and{,not} Yury Norov
2026-01-14 17:56   ` Gregory Price
2026-01-14 17:22 ` [PATCH 2/3] mm: use nodes_and() return value to simplify client code Yury Norov
2026-01-14 17:56   ` Gregory Price
2026-01-14 17:22 ` [PATCH 3/3] cgroup: use nodes_and() output where appropriate Yury Norov
2026-01-14 18:00   ` Gregory Price
2026-01-14 22:13   ` Michal Koutný
2026-01-14 22:33   ` Waiman Long
2026-01-15  0:52     ` Chen Ridong [this message]
2026-01-14 19:37 ` [PATCH 0/3] nodemask: align nodes_and{,not} with underlying bitmap ops Joshua Hahn

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=2e8bf48a-b819-40b9-bb9b-f6ac6672059a@huaweicloud.com \
    --to=chenridong@huaweicloud.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=byungchul@sk.com \
    --cc=cgroups@vger.kernel.org \
    --cc=david@kernel.org \
    --cc=gourry@gourry.net \
    --cc=hannes@cmpxchg.org \
    --cc=joshua.hahnjy@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=llong@redhat.com \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=matthew.brost@intel.com \
    --cc=mhocko@suse.com \
    --cc=mkoutny@suse.com \
    --cc=rakie.kim@sk.com \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=tj@kernel.org \
    --cc=vbabka@suse.cz \
    --cc=ying.huang@linux.alibaba.com \
    --cc=ynorov@nvidia.com \
    --cc=yury.norov@gmail.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