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.

nodemask: propagate boolean for nodes_and{,not}

Patch series "nodemask: align nodes_and{,not} with underlying bitmap ops".

nodes_and{,not} are void despite that underlying bitmap_and(,not) return
boolean, true if the result bitmap is non-empty. Align nodemask API, and
simplify client code.


This patch (of 3):

Bitmap functions bitmap_and{,not} return boolean depending on emptiness of
the result bitmap. The corresponding nodemask helpers ignore the returned
value.

Propagate the underlying bitmaps result to nodemasks users, as it
simplifies user code.

Link: https://lkml.kernel.org/r/20260114172217.861204-1-ynorov@nvidia.com
Link: https://lkml.kernel.org/r/20260114172217.861204-2-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>
Reviewed-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: 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
cbc064e7 641d47d4

+4 -4
+4 -4
include/linux/nodemask.h
··· 157 157 158 158 #define nodes_and(dst, src1, src2) \ 159 159 __nodes_and(&(dst), &(src1), &(src2), MAX_NUMNODES) 160 - static __always_inline void __nodes_and(nodemask_t *dstp, const nodemask_t *src1p, 160 + static __always_inline bool __nodes_and(nodemask_t *dstp, const nodemask_t *src1p, 161 161 const nodemask_t *src2p, unsigned int nbits) 162 162 { 163 - bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits); 163 + return bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits); 164 164 } 165 165 166 166 #define nodes_or(dst, src1, src2) \ ··· 181 181 182 182 #define nodes_andnot(dst, src1, src2) \ 183 183 __nodes_andnot(&(dst), &(src1), &(src2), MAX_NUMNODES) 184 - static __always_inline void __nodes_andnot(nodemask_t *dstp, const nodemask_t *src1p, 184 + static __always_inline bool __nodes_andnot(nodemask_t *dstp, const nodemask_t *src1p, 185 185 const nodemask_t *src2p, unsigned int nbits) 186 186 { 187 - bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits); 187 + return bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits); 188 188 } 189 189 190 190 #define nodes_copy(dst, src) __nodes_copy(&(dst), &(src), MAX_NUMNODES)