mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alessio Maroni <alessiomaroni0@gmail.com>
To: Yury Norov <yury.norov@gmail.com>,
	David Hildenbrand <david@kernel.org>,
	"Michael S . Tsirkin" <mst@redhat.com>
Cc: "Jason Wang" <jasowangio@gmail.com>,
	"Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Eugenio Pérez" <eperezma@redhat.com>,
	"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
	virtualization@lists.linux.dev, linux-kernel@vger.kernel.org,
	"Alessio Maroni" <alessiomaroni0@gmail.com>
Subject: [PATCH 0/2] bitmap: add bitmap_all_set()/bitmap_all_clear() and use in virtio-mem
Date: Sun,  6 Dec 2026 14:52:18 +0100	[thread overview]
Message-ID: <20261206135220.153130-1-alessiomaroni0@gmail.com> (raw)

This series introduces bitmap_all_set() and bitmap_all_clear() to check
whether all bits in an arbitrary [start, start + nbits) range are set
or clear, and uses them to clean up open-coded find_next_*_bit() checks
in virtio-mem.

Patch 1 adds the two helpers in include/linux/bitmap.h (with compile-time
fast paths for zero, single-bit, and small single-word ranges) along
with selftest coverage in lib/test_bitmap.c.

Patch 2 replaces the manual find_next_zero_bit() / find_next_bit()
expressions in drivers/virtio/virtio_mem.c, resolving the existing TODO
comments.

Tested with lib/test_bitmap selftests (all 454551 tests passed) and
memory hotplug/unplug cycles on QEMU x86_64 with virtio-mem-pci, as
well as W=1 builds and checkpatch.pl --strict.

Alessio Maroni (2):
  bitmap: add bitmap_all_set() and bitmap_all_clear()
  virtio-mem: use bitmap_all_set() and bitmap_all_clear()

 drivers/virtio/virtio_mem.c | 11 ++-------
 include/linux/bitmap.h      | 47 +++++++++++++++++++++++++++++++++++++
 lib/test_bitmap.c           | 38 ++++++++++++++++++++++++++++++
 3 files changed, 87 insertions(+), 9 deletions(-)

-- 
2.56.1


             reply	other threads:[~2026-12-06 13:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-06 13:52 Alessio Maroni [this message]
2026-12-06 13:52 ` [PATCH 1/2] bitmap: add bitmap_all_set() and bitmap_all_clear() Alessio Maroni
2026-12-06 13:52 ` [PATCH 2/2] virtio-mem: use " Alessio Maroni

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=20261206135220.153130-1-alessiomaroni0@gmail.com \
    --to=alessiomaroni0@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=eperezma@redhat.com \
    --cc=jasowangio@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux.dev \
    --cc=xuanzhuo@linux.alibaba.com \
    --cc=yury.norov@gmail.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

all inboxes | Powered by JetHome®