Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

cgroup: use nodes_and() output where appropriate

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).

Link: https://lkml.kernel.org/r/20260114172217.861204-4-ynorov@nvidia.com
Signed-off-by: Yury Norov <ynorov@nvidia.com>
Reviewed-by: Gregory Price <gourry@gourry.net>
Reviewed-by: Joshua Hahn <joshua.hahnjy@gmail.com>
Acked-by: Tejun Heo <tj@kernel.org>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Byungchul Park <byungchul@sk.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: "Huang, Ying" <ying.huang@linux.alibaba.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Mathew Brost <matthew.brost@intel.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Michal Koutný <mkoutny@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Rakie Kim <rakie.kim@sk.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Waiman Long <longman@redhat.com>
Cc: Yury Norov (NVIDIA) <yury.norov@gmail.com>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Yury Norov and committed by
Andrew Morton
291487b7 386781df

+3 -4
+3 -4
kernel/cgroup/cpuset.c
··· 453 453 */ 454 454 static void guarantee_online_mems(struct cpuset *cs, nodemask_t *pmask) 455 455 { 456 - while (!nodes_intersects(cs->effective_mems, node_states[N_MEMORY])) 456 + while (!nodes_and(*pmask, cs->effective_mems, node_states[N_MEMORY])) 457 457 cs = parent_cs(cs); 458 - nodes_and(*pmask, cs->effective_mems, node_states[N_MEMORY]); 459 458 } 460 459 461 460 /** ··· 2858 2859 cpuset_for_each_descendant_pre(cp, pos_css, cs) { 2859 2860 struct cpuset *parent = parent_cs(cp); 2860 2861 2861 - nodes_and(*new_mems, cp->mems_allowed, parent->effective_mems); 2862 + bool has_mems = nodes_and(*new_mems, cp->mems_allowed, parent->effective_mems); 2862 2863 2863 2864 /* 2864 2865 * If it becomes empty, inherit the effective mask of the 2865 2866 * parent, which is guaranteed to have some MEMs. 2866 2867 */ 2867 - if (is_in_v2_mode() && nodes_empty(*new_mems)) 2868 + if (is_in_v2_mode() && !has_mems) 2868 2869 *new_mems = parent->effective_mems; 2869 2870 2870 2871 /* Skip the whole subtree if the nodemask remains the same. */