All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Lorenzo Stoakes (Oracle)" <ljs@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Dan Williams <dan.j.williams@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Dave Jiang <dave.jiang@intel.com>, Gao Xiang <xiang@kernel.org>,
	Chao Yu <chao@kernel.org>, Yue Hu <zbestahu@gmail.com>,
	Jeffle Xu <jefflexu@linux.alibaba.com>,
	Sandeep Dhavale <dhavale@google.com>,
	Hongbo Li <lihongbo22@huawei.com>,
	Chunhai Guo <guochunhai@vivo.com>,
	Muchun Song <muchun.song@linux.dev>,
	Oscar Salvador <osalvador@suse.de>,
	David Hildenbrand <david@kernel.org>,
	Konstantin Komarov <almaz.alexandrovich@paragon-software.com>,
	Tony Luck <tony.luck@intel.com>,
	Reinette Chatre <reinette.chatre@intel.com>,
	Dave Martin <Dave.Martin@arm.com>,
	James Morse <james.morse@arm.com>,
	Babu Moger <babu.moger@amd.com>,
	Damien Le Moal <dlemoal@kernel.org>,
	Naohiro Aota <naohiro.aota@wdc.com>,
	Johannes Thumshirn <jth@kernel.org>,
	Matthew Wilcox <willy@infradead.org>, Jan Kara <jack@suse.cz>,
	"Liam R . Howlett" <Liam.Howlett@oracle.com>,
	Vlastimil Babka <vbabka@kernel.org>,
	Mike Rapoport <rppt@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>, Hugh Dickins <hughd@google.com>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	Jann Horn <jannh@google.com>, Pedro Falcato <pfalcato@suse.de>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	linux-kernel@vger.kernel.org, nvdimm@lists.linux.dev,
	linux-cxl@vger.kernel.org, linux-erofs@lists.ozlabs.org,
	linux-mm@kvack.org, ntfs3@lists.linux.dev,
	linux-fsdevel@vger.kernel.org
Subject: [PATCH 0/6] mm: vma flag tweaks
Date: Thu,  5 Mar 2026 10:50:13 +0000	[thread overview]
Message-ID: <cover.1772704455.git.ljs@kernel.org> (raw)

The ongoing work around introducing non-system word VMA flags has
introduced a number of helper functions and macros to make life easier when
working with these flags and to make conversions from the legacy use of
VM_xxx flags more straightforward.

This series improves these to reduce confusion as to what they do and to
improve consistency and readability.

Firstly the series renames vma_flags_test() to vma_flags_test_any() to make
it abundantly clear that this function tests whether any of the flags are
set (as opposed to vma_flags_test_all()).

It then renames vma_desc_test_flags() to vma_desc_test_any() for the same
reason. Note that we drop the 'flags' suffix here, as
vma_desc_test_any_flags() would be cumbersome and 'test' implies a flag
test.

Similarly, we rename vma_test_all_flags() to vma_test_all() for
consistency.

Next, we have a couple of instances (erofs, zonefs) where we are now
testing for vma_desc_test_any(desc, VMA_SHARED_BIT) &&
vma_desc_test_any(desc, VMA_MAYWRITE_BIT).

This is silly, so this series introduces vma_desc_test_all() so these
callers can instead invoke vma_desc_test_all(desc, VMA_SHARED_BIT,
VMA_MAYWRITE_BIT).

We then observe that quite a few instances of vma_flags_test_any() and
vma_desc_test_any() are in fact only testing against a single flag.

Using the _any() variant here is just confusing - 'any' of single item
reads strangely and is liable to cause confusion.

So in these instances the series reintroduces vma_flags_test() and
vma_desc_test() as helpers which test against a single flag.

The fact that vma_flags_t is a struct and that vma_flag_t utilises sparse
to avoid confusion with vm_flags_t makes it impossible for a user to misuse
these helpers without it getting flagged somewhere.

The series also updates __mk_vma_flags() and functions invoked by it to
explicitly mark them always inline to match expectation and to be
consistent with other VMA flag helpers.

It also renames vma_flag_set() to vma_flags_set_flag() (a function only
used by __mk_vma_flags()) to be consistent with other VMA flag helpers.

Finally it updates the VMA tests for each of these changes, and introduces
explicit tests for vma_flags_test() and vma_desc_test() to assert that they
behave as expected.

Lorenzo Stoakes (Oracle) (6):
  mm: rename VMA flag helpers to be more readable
  mm: add vma_desc_test_all() and use it
  mm: always inline __mk_vma_flags() and invoked functions
  mm: reintroduce vma_flags_test() as a singular flag test
  mm: reintroduce vma_desc_test() as a singular flag test
  tools/testing/vma: add test for vma_flags_test(), vma_desc_test()

 drivers/char/mem.c                 |   2 +-
 drivers/dax/device.c               |   2 +-
 fs/erofs/data.c                    |   3 +-
 fs/hugetlbfs/inode.c               |   2 +-
 fs/ntfs3/file.c                    |   2 +-
 fs/resctrl/pseudo_lock.c           |   2 +-
 fs/zonefs/file.c                   |   3 +-
 include/linux/dax.h                |   4 +-
 include/linux/hugetlb_inline.h     |   2 +-
 include/linux/mm.h                 | 100 +++++++++++++++++++++--------
 include/linux/mm_types.h           |   2 +-
 mm/hugetlb.c                       |  12 ++--
 mm/memory.c                        |   2 +-
 mm/secretmem.c                     |   2 +-
 tools/testing/vma/include/custom.h |   5 +-
 tools/testing/vma/include/dup.h    |  48 ++++++++++----
 tools/testing/vma/tests/vma.c      |  58 +++++++++++++----
 17 files changed, 177 insertions(+), 74 deletions(-)

--
2.53.0

             reply	other threads:[~2026-03-05 10:50 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-05 10:50 Lorenzo Stoakes (Oracle) [this message]
2026-03-05 10:50 ` [PATCH 1/6] mm: rename VMA flag helpers to be more readable Lorenzo Stoakes (Oracle)
2026-03-25  8:55   ` David Hildenbrand (Arm)
2026-03-25 14:51   ` Pedro Falcato
2026-03-25 14:53     ` Lorenzo Stoakes (Oracle)
2026-03-05 10:50 ` [PATCH 2/6] mm: add vma_desc_test_all() and use it Lorenzo Stoakes (Oracle)
2026-03-24 23:12   ` Andrew Morton
2026-03-25  7:08     ` Lorenzo Stoakes (Oracle)
2026-03-25 14:30       ` Andrew Morton
2026-03-25 16:20         ` Lorenzo Stoakes (Oracle)
2026-03-25  7:31   ` Vlastimil Babka (SUSE)
2026-03-25  8:58     ` David Hildenbrand (Arm)
2026-03-25 11:02       ` Lorenzo Stoakes (Oracle)
2026-03-25  8:56   ` David Hildenbrand (Arm)
2026-03-25 14:52   ` Pedro Falcato
2026-03-05 10:50 ` [PATCH 3/6] mm: always inline __mk_vma_flags() and invoked functions Lorenzo Stoakes (Oracle)
2026-03-05 14:48   ` David Hildenbrand (Arm)
2026-03-25 14:54   ` Pedro Falcato
2026-03-25 14:58     ` Lorenzo Stoakes (Oracle)
2026-03-25 16:09       ` Andrew Morton
2026-03-25 16:23         ` Lorenzo Stoakes (Oracle)
2026-03-25 18:27           ` Andrew Morton
2026-03-25 18:44             ` Lorenzo Stoakes (Oracle)
2026-03-25 19:11               ` Andrew Morton
2026-03-05 10:50 ` [PATCH 4/6] mm: reintroduce vma_flags_test() as a singular flag test Lorenzo Stoakes (Oracle)
2026-03-05 13:49   ` David Hildenbrand (Arm)
2026-03-25 14:57   ` Pedro Falcato
2026-03-25 15:02     ` Lorenzo Stoakes (Oracle)
2026-03-05 10:50 ` [PATCH 5/6] mm: reintroduce vma_desc_test() " Lorenzo Stoakes (Oracle)
2026-03-05 13:49   ` David Hildenbrand (Arm)
2026-03-25 14:58   ` Pedro Falcato
2026-03-05 10:50 ` [PATCH 6/6] tools/testing/vma: add test for vma_flags_test(), vma_desc_test() Lorenzo Stoakes (Oracle)
2026-03-05 13:52   ` David Hildenbrand (Arm)
2026-03-05 15:01     ` Lorenzo Stoakes (Oracle)
2026-03-05 15:42       ` David Hildenbrand (Arm)
2026-03-25  8:57       ` David Hildenbrand (Arm)
2026-03-25 15:00   ` Pedro Falcato
2026-03-06  1:28 ` [PATCH 0/6] mm: vma flag tweaks Andrew Morton

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=cover.1772704455.git.ljs@kernel.org \
    --to=ljs@kernel.org \
    --cc=Dave.Martin@arm.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=almaz.alexandrovich@paragon-software.com \
    --cc=arnd@arndb.de \
    --cc=babu.moger@amd.com \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=chao@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=david@kernel.org \
    --cc=dhavale@google.com \
    --cc=dlemoal@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=guochunhai@vivo.com \
    --cc=hughd@google.com \
    --cc=jack@suse.cz \
    --cc=james.morse@arm.com \
    --cc=jannh@google.com \
    --cc=jefflexu@linux.alibaba.com \
    --cc=jgg@ziepe.ca \
    --cc=jth@kernel.org \
    --cc=lihongbo22@huawei.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=naohiro.aota@wdc.com \
    --cc=ntfs3@lists.linux.dev \
    --cc=nvdimm@lists.linux.dev \
    --cc=osalvador@suse.de \
    --cc=pfalcato@suse.de \
    --cc=reinette.chatre@intel.com \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=tony.luck@intel.com \
    --cc=vbabka@kernel.org \
    --cc=vishal.l.verma@intel.com \
    --cc=willy@infradead.org \
    --cc=xiang@kernel.org \
    --cc=zbestahu@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.