On 03/03/2020 10:55 PM, Vlastimil Babka wrote: > On 3/2/20 7:47 AM, Anshuman Khandual wrote: >> There are many platforms with exact same value for VM_DATA_DEFAULT_FLAGS >> This creates a default value for VM_DATA_DEFAULT_FLAGS in line with the >> existing VM_STACK_DEFAULT_FLAGS. While here, also define some more macros >> with standard VMA access flag combinations that are used frequently across >> many platforms. Apart from simplification, this reduces code duplication >> as well. >> >> Cc: Richard Henderson <rth****@twidd*****> >> Cc: Vineet Gupta <vgupt****@synop*****> >> Cc: Russell King <linux****@armli*****> >> Cc: Catalin Marinas <catal****@arm*****> >> Cc: Mark Salter <msalt****@redha*****> >> Cc: Guo Ren <guore****@kerne*****> >> Cc: Yoshinori Sato <ysato****@users*****> >> Cc: Brian Cain <bcain****@codea*****> >> Cc: Tony Luck <tony.****@intel*****> >> Cc: Geert Uytterhoeven <geert****@linux*****> >> Cc: Michal Simek <monst****@monst*****> >> Cc: Ralf Baechle <ralf****@linux*****> >> Cc: Paul Burton <paulb****@kerne*****> >> Cc: Nick Hu <nickh****@andes*****> >> Cc: Ley Foon Tan <ley.f****@intel*****> >> Cc: Jonas Bonn <jonas****@south*****> >> Cc: "James E.J. Bottomley" <James****@Hanse*****> >> Cc: Michael Ellerman <mpe****@eller*****> >> Cc: Paul Walmsley <paul.****@sifiv*****> >> Cc: Heiko Carstens <heiko****@de*****> >> Cc: Rich Felker <dalia****@libc*****> >> Cc: "David S. Miller" <davem****@davem*****> >> Cc: Guan Xuetao <gxt****@pku*****> >> Cc: Thomas Gleixner <tglx****@linut*****> >> Cc: Jeff Dike <jdike****@addto*****> >> Cc: Chris Zankel <chris****@zanke*****> >> Cc: Andrew Morton <akpm****@linux*****> >> Cc: linux****@vger***** >> Cc: linux****@vger***** >> Cc: linux****@lists***** >> Cc: linux****@lists***** >> Cc: linux****@linux***** >> Cc: uclin****@lists***** >> Cc: linux****@vger***** >> Cc: linux****@vger***** >> Cc: linux****@lists***** >> Cc: linux****@vger***** >> Cc: nios2****@lists***** >> Cc: openr****@lists***** >> Cc: linux****@vger***** >> Cc: linux****@lists***** >> Cc: linux****@lists***** >> Cc: linux****@vger***** >> Cc: linux****@vger***** >> Cc: sparc****@vger***** >> Cc: linux****@lists***** >> Cc: linux****@linux***** >> Cc: linux****@kvack***** >> Signed-off-by: Anshuman Khandual <anshu****@arm***** > Reviewed-by: Vlastimil Babka <vbabk****@suse*****> > > Nit: > >> diff --git a/include/linux/mm.h b/include/linux/mm.h >> index b0e53ef13ff1..7a764ae6ab68 100644 >> --- a/include/linux/mm.h >> +++ b/include/linux/mm.h >> @@ -342,6 +342,21 @@ extern unsigned int kobjsize(const void *objp); >> /* Bits set in the VMA until the stack is in its final location */ >> #define VM_STACK_INCOMPLETE_SETUP (VM_RAND_READ | VM_SEQ_READ) >> >> +#define TASK_EXEC ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0) >> + >> +/* Common data flag combinations */ >> +#define VM_DATA_FLAGS_TSK_EXEC (VM_READ | VM_WRITE | TASK_EXEC | \ >> + VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) >> +#define VM_DATA_FLAGS_NON_EXEC (VM_READ | VM_WRITE | VM_MAYREAD | \ >> + VM_MAYWRITE | VM_MAYEXEC) >> +#define VM_DATA_FLAGS_EXEC (VM_READ | VM_WRITE | VM_EXEC | \ >> + VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) >> + >> +#ifndef VM_DATA_DEFAULT_FLAGS /* arch can override this */ >> +#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ >> + VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) > > Should you use VM_DATA_FLAGS_EXEC here? Yeah one more macro to expand, but it's > right above this. Sure, can do that. > >> +#endif >> + >> #ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ >> #define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS >> #endif >> > > >