All of lore.kernel.org
 help / color / mirror / Atom feed
* + mm-avoid-use-of-bit-macro-for-initialising-vma-flags.patch added to mm-unstable branch
@ 2025-12-05 20:15 Andrew Morton
  2025-12-08 16:09 ` Vlastimil Babka
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew Morton @ 2025-12-05 20:15 UTC (permalink / raw)
  To: mm-commits, vbabka, surenb, rppt, oliver.sang, mhocko,
	liam.howlett, jhubbard, david.laight.linux, lorenzo.stoakes, akpm


The patch titled
     Subject: mm: avoid use of BIT() macro for initialising VMA flags
has been added to the -mm mm-unstable branch.  Its filename is
     mm-avoid-use-of-bit-macro-for-initialising-vma-flags.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-avoid-use-of-bit-macro-for-initialising-vma-flags.patch

This patch will later appear in the mm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days

------------------------------------------------------
From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Subject: mm: avoid use of BIT() macro for initialising VMA flags
Date: Fri, 5 Dec 2025 17:50:37 +0000

Commit 2b6a3f061f11 ("mm: declare VMA flags by bit") significantly changed
how VMA flags are declared, utilising an enum of VMA bit values and
ifdef-fery VM_xxx flag declarations via macro.

As part of this change, it uses INIT_VM_FLAG() to define VM_xxx flags from
the newly introduced VMA bit numbers.

However, use of this macro results in apparently unfortunate macro
expansion and resulted in a performance degradation.This appears to be due
to the (__force int), which is required for the sparse typechecking to
work.

Avoid macro expansion issues by simply using 1UL << bitnum.

Link: https://lkml.kernel.org/r/20251205175037.1287366-1-lorenzo.stoakes@oracle.com
Fixes: 2b6a3f061f11 ("mm: declare VMA flags by bit")
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202512041634.150c7e4f-lkp@intel.com
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: David Laight <david.laight.linux@gmail.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/linux/mm.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/include/linux/mm.h~mm-avoid-use-of-bit-macro-for-initialising-vma-flags
+++ a/include/linux/mm.h
@@ -395,7 +395,8 @@ enum {
 #undef DECLARE_VMA_BIT
 #undef DECLARE_VMA_BIT_ALIAS
 
-#define INIT_VM_FLAG(name) BIT((__force int) VMA_ ## name ## _BIT)
+#define INIT_VM_FLAG(name) (1UL << (__force int)(VMA_ ## name ## _BIT))
+
 #define VM_READ		INIT_VM_FLAG(READ)
 #define VM_WRITE	INIT_VM_FLAG(WRITE)
 #define VM_EXEC		INIT_VM_FLAG(EXEC)
_

Patches currently in -mm which might be from lorenzo.stoakes@oracle.com are

mm-avoid-use-of-bit-macro-for-initialising-vma-flags.patch


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-12-12 17:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-05 20:15 + mm-avoid-use-of-bit-macro-for-initialising-vma-flags.patch added to mm-unstable branch Andrew Morton
2025-12-08 16:09 ` Vlastimil Babka
2025-12-09  1:40   ` Andrew Morton
2025-12-09  8:23     ` Vlastimil Babka
2025-12-09 19:29     ` Andrew Morton
2025-12-10  9:36       ` Lorenzo Stoakes
2025-12-10 17:46         ` Andrew Morton
2025-12-12 17:46           ` Lorenzo Stoakes
2025-12-12 17:53             ` Vlastimil Babka

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.