Skip to content

Commit 188db2f

Browse files
lorenzo-stoakesakpm00
authored andcommitted
mm: avoid use of BIT() macro for initialising VMA flags
Commit 2b6a3f0 ("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/[email protected] Fixes: 2b6a3f0 ("mm: declare VMA flags by bit") Signed-off-by: Lorenzo Stoakes <[email protected]> Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-lkp/[email protected] Cc: Liam Howlett <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Mike Rapoport <[email protected]> Cc: Suren Baghdasaryan <[email protected]> Cc: Vlastimil Babka <[email protected]> Cc: David Laight <[email protected]> Cc: John Hubbard <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent a538792 commit 188db2f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/linux/mm.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,8 @@ enum {
395395
#undef DECLARE_VMA_BIT
396396
#undef DECLARE_VMA_BIT_ALIAS
397397

398-
#define INIT_VM_FLAG(name) BIT((__force int) VMA_ ## name ## _BIT)
398+
#define INIT_VM_FLAG(name) (1UL << (__force int)(VMA_ ## name ## _BIT))
399+
399400
#define VM_READ INIT_VM_FLAG(READ)
400401
#define VM_WRITE INIT_VM_FLAG(WRITE)
401402
#define VM_EXEC INIT_VM_FLAG(EXEC)

0 commit comments

Comments
 (0)