Re: [PATCH v2] mm/ksm: fix flag-dropping behavior in ksm_madvise

From: Jakub Acs

Date: Wed Oct 01 2025 - 05:08:14 EST


On Tue, Sep 30, 2025 at 05:32:25PM +0200, David Hildenbrand wrote:
> If we want a smaller patch for easier backporting, we could split
> off the VM_MERGEABLE change into a separate patch and do all the
> other ones for consistency in another
>
> Reading what we do VM_HIGH_ARCH_BIT_* , we use BIT(), which does
>
> #define BIT(nr) (UL(1) << (nr))
>
> So likely we should just clean it all up an use e.g.,
>
> #define VM_NONE 0
> #define VM_READ BIT(0)
> #define VM_WRITE BIT(1)
>
> etc.
>
> So likely it's best to do in a first fix
> #define VM_MERGEABLE BIT(31)
>
> And in a follow-up cleanup patch convert all the other ones.

Sent in v3:
https://lore.kernel.org/all/20251001090353.57523-1-acsjakub@xxxxxxxxx/

It's the first time I sent a series, please let me know if I did
something wrong :)

>
> Sorry for not thinking about BIT() earlier
>

No worries :)

Kind Regards,
Jakub



Amazon Web Services Development Center Germany GmbH
Tamara-Danz-Str. 13
10243 Berlin
Geschaeftsfuehrung: Christian Schlaeger
Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
Sitz: Berlin
Ust-ID: DE 365 538 597