linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yury Norov <ynorov@nvidia.com>
To: "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>,
	"Waiman Long" <longman@redhat.com>,
	"Ying Huang" <ying.huang@linux.alibaba.com>,
	"Zi Yan" <ziy@nvidia.com>,
	cgroups@vger.kernel.org
Cc: Yury Norov <ynorov@nvidia.com>, Yury Norov <yury.norov@gmail.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] nodemask: propagate boolean for nodes_and{,not}
Date: Wed, 14 Jan 2026 12:22:13 -0500	[thread overview]
Message-ID: <20260114172217.861204-2-ynorov@nvidia.com> (raw)
In-Reply-To: <20260114172217.861204-1-ynorov@nvidia.com>

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.

Signed-off-by: Yury Norov <ynorov@nvidia.com>
---
 include/linux/nodemask.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index bd38648c998d..204c92462f3c 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -157,10 +157,10 @@ static __always_inline bool __node_test_and_set(int node, nodemask_t *addr)
 
 #define nodes_and(dst, src1, src2) \
 			__nodes_and(&(dst), &(src1), &(src2), MAX_NUMNODES)
-static __always_inline void __nodes_and(nodemask_t *dstp, const nodemask_t *src1p,
+static __always_inline bool __nodes_and(nodemask_t *dstp, const nodemask_t *src1p,
 					const nodemask_t *src2p, unsigned int nbits)
 {
-	bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits);
+	return bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits);
 }
 
 #define nodes_or(dst, src1, src2) \
@@ -181,10 +181,10 @@ static __always_inline void __nodes_xor(nodemask_t *dstp, const nodemask_t *src1
 
 #define nodes_andnot(dst, src1, src2) \
 			__nodes_andnot(&(dst), &(src1), &(src2), MAX_NUMNODES)
-static __always_inline void __nodes_andnot(nodemask_t *dstp, const nodemask_t *src1p,
+static __always_inline bool __nodes_andnot(nodemask_t *dstp, const nodemask_t *src1p,
 					const nodemask_t *src2p, unsigned int nbits)
 {
-	bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits);
+	return bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits);
 }
 
 #define nodes_copy(dst, src) __nodes_copy(&(dst), &(src), MAX_NUMNODES)
-- 
2.43.0



  reply	other threads:[~2026-01-14 17:22 UTC|newest]

Thread overview: 8+ 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 ` Yury Norov [this message]
2026-01-14 17:56   ` [PATCH 1/3] nodemask: propagate boolean for nodes_and{,not} 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 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=20260114172217.861204-2-ynorov@nvidia.com \
    --to=ynorov@nvidia.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=longman@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=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