Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/vma: introduce vma_clear_flags[_mask]()

Introduce a helper function and helper macro to easily clear a VMA's flags
using the new vma_flags_t vma->flags field:

* vma_clear_flags_mask() - Clears all of the flags in a specified mask in
the VMA's flags field.
* vma_clear_flags() - Clears all of the specified individual VMA flag bits
in a VMA's flags field.

Also update the VMA tests to reflect the change.

Link: https://lkml.kernel.org/r/9bd15da35c2c90e7441265adf01b5c2d3b5c6d41.1774034900.git.ljs@kernel.org
Signed-off-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
Acked-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Cc: "Borislav Petkov (AMD)" <bp@alien8.de>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Chengming Zhou <chengming.zhou@linux.dev>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Dinh Nguyen <dinguyen@kernel.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Jann Horn <jannh@google.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Kees Cook <kees@kernel.org>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Ondrej Mosnacek <omosnace@redhat.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Moore <paul@paul-moore.com>
Cc: Pedro Falcato <pfalcato@suse.de>
Cc: Richard Weinberger <richard@nod.at>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Stephen Smalley <stephen.smalley.work@gmail.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Vineet Gupta <vgupta@kernel.org>
Cc: WANG Xuerui <kernel@xen0n.name>
Cc: Will Deacon <will@kernel.org>
Cc: xu xin <xu.xin16@zte.com.cn>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Lorenzo Stoakes (Oracle) and committed by
Andrew Morton
d720b81d 7eb19a87

+25
+16
include/linux/mm.h
··· 1363 1363 #define vma_set_flags(vma, ...) \ 1364 1364 vma_set_flags_mask(vma, mk_vma_flags(__VA_ARGS__)) 1365 1365 1366 + /* Helper to clear all VMA flags in a VMA. */ 1367 + static __always_inline void vma_clear_flags_mask(struct vm_area_struct *vma, 1368 + vma_flags_t flags) 1369 + { 1370 + vma_flags_clear_mask(&vma->flags, flags); 1371 + } 1372 + 1373 + /* 1374 + * Helper macro for clearing VMA flags, e.g.: 1375 + * 1376 + * vma_clear_flags(vma, VMA_IO_BIT, VMA_PFNMAP_BIT, VMA_DONTEXPAND_BIT, 1377 + * VMA_DONTDUMP_BIT); 1378 + */ 1379 + #define vma_clear_flags(vma, ...) \ 1380 + vma_clear_flags_mask(vma, mk_vma_flags(__VA_ARGS__)) 1381 + 1366 1382 /* 1367 1383 * Test whether a specific VMA flag is set in a VMA descriptor, e.g.: 1368 1384 *
+9
tools/testing/vma/include/dup.h
··· 1065 1065 #define vma_set_flags(vma, ...) \ 1066 1066 vma_set_flags_mask(vma, mk_vma_flags(__VA_ARGS__)) 1067 1067 1068 + static __always_inline void vma_clear_flags_mask(struct vm_area_struct *vma, 1069 + vma_flags_t flags) 1070 + { 1071 + vma_flags_clear_mask(&vma->flags, flags); 1072 + } 1073 + 1074 + #define vma_clear_flags(vma, ...) \ 1075 + vma_clear_flags_mask(vma, mk_vma_flags(__VA_ARGS__)) 1076 + 1068 1077 static __always_inline bool vma_desc_test(const struct vm_area_desc *desc, 1069 1078 vma_flag_t bit) 1070 1079 {