mm: use nodes_and() return value to simplify client code
establish_demotion_targets() and kernel_migrate_pages() call node_empty() immediately after calling nodes_and(). Now that nodes_and() return false if nodemask is empty, drop the latter. Link: https://lkml.kernel.org/r/20260114172217.861204-3-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: Vlastimil Babka <vbabka@suse.cz> Acked-by: David Hildenbrand (Red Hat) <david@kernel.org> Cc: Alistair Popple <apopple@nvidia.com> Cc: Byungchul Park <byungchul@sk.com> 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: Tejun Heo <tj@kernel.org> 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:
parent
cbc064e708
commit
386781df63
|
|
@ -475,8 +475,7 @@ static void establish_demotion_targets(void)
|
|||
*/
|
||||
list_for_each_entry_reverse(memtier, &memory_tiers, list) {
|
||||
tier_nodes = get_memtier_nodemask(memtier);
|
||||
nodes_and(tier_nodes, node_states[N_CPU], tier_nodes);
|
||||
if (!nodes_empty(tier_nodes)) {
|
||||
if (nodes_and(tier_nodes, node_states[N_CPU], tier_nodes)) {
|
||||
/*
|
||||
* abstract distance below the max value of this memtier
|
||||
* is considered toptier.
|
||||
|
|
|
|||
|
|
@ -1909,8 +1909,7 @@ static int kernel_migrate_pages(pid_t pid, unsigned long maxnode,
|
|||
}
|
||||
|
||||
task_nodes = cpuset_mems_allowed(current);
|
||||
nodes_and(*new, *new, task_nodes);
|
||||
if (nodes_empty(*new))
|
||||
if (!nodes_and(*new, *new, task_nodes))
|
||||
goto out_put;
|
||||
|
||||
err = security_task_movememory(task);
|
||||
|
|
|
|||
Loading…
Reference in New Issue