Re: [PATCH 4/4] mm: introduce and use VMA flag test helpers
From: Jason Gunthorpe
Date: Thu Oct 30 2025 - 13:54:24 EST
On Thu, Oct 30, 2025 at 02:03:02PM +0000, Lorenzo Stoakes wrote:
> Yeah, OK well your point has been made here, the compiler _is_ smart enough
> to save us here :)
>
> Let's avoid this first word stuff altogether then.
I suggest to add some helpers to the general include/linux/bitmap.h
"subsystem" that lets it help do this:
#define BITMAP_OR_BITS(type, member, bit1, bit2, bit3)
returns a type with the bitmap array member initialized to those bits
Then some other bitmap helpers that are doing the specific maths you
want..
* bitmap_and_eq(src1, src2, src3, nbits) true if *src1 & *src2 == *src3
* bitmap_and_eq_zero(src1, src2, nbits) true if *src1 & *src1 == 0
etc
Jason