From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,vbabka@suse.cz,surenb@google.com,rppt@kernel.org,oliver.sang@intel.com,mhocko@suse.com,liam.howlett@oracle.com,jhubbard@nvidia.com,david.laight.linux@gmail.com,lorenzo.stoakes@oracle.com,akpm@linux-foundation.org
Subject: + mm-avoid-use-of-bit-macro-for-initialising-vma-flags.patch added to mm-unstable branch
Date: Fri, 05 Dec 2025 12:15:09 -0800 [thread overview]
Message-ID: <20251205201510.3D83EC4CEF1@smtp.kernel.org> (raw)
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
next reply other threads:[~2025-12-05 20:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-05 20:15 Andrew Morton [this message]
2025-12-08 16:09 ` + mm-avoid-use-of-bit-macro-for-initialising-vma-flags.patch added to mm-unstable branch 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
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=20251205201510.3D83EC4CEF1@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=david.laight.linux@gmail.com \
--cc=jhubbard@nvidia.com \
--cc=liam.howlett@oracle.com \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@suse.com \
--cc=mm-commits@vger.kernel.org \
--cc=oliver.sang@intel.com \
--cc=rppt@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
/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.