mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
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>
This commit is contained in:
committed by
Andrew Morton
parent
386781df63
commit
291487b753
@@ -453,9 +453,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]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2859,13 +2858,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. */
|
||||
|
||||
Reference in New Issue
Block a user