On 03/03/2020 11:18 PM, Vlastimil Babka wrote: > On 3/2/20 7:47 AM, Anshuman Khandual wrote: >> There are many places where all basic VMA access flags (read, write, exec) >> are initialized or checked against as a group. One such example is during >> page fault. Existing vma_is_accessible() wrapper already creates the notion >> of VMA accessibility as a group access permissions. Hence lets just create >> VM_ACCESS_FLAGS (VM_READ|VM_WRITE|VM_EXEC) which will not only reduce code >> duplication but also extend the VMA accessibility concept in general. >> >> Cc: Russell King <linux@xxxxxxxxxxxxxxx> >> CC: Catalin Marinas <catalin.marinas@xxxxxxx> >> CC: Mark Salter <msalter@xxxxxxxxxx> >> Cc: Nick Hu <nickhu@xxxxxxxxxxxxx> >> CC: Ley Foon Tan <ley.foon.tan@xxxxxxxxx> >> Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx> >> Cc: Heiko Carstens <heiko.carstens@xxxxxxxxxx> >> Cc: Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx> >> Cc: Guan Xuetao <gxt@xxxxxxxxxx> >> Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx> >> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> >> Cc: Rob Springer <rspringer@xxxxxxxxxx> >> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> >> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> >> Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx >> Cc: linux-c6x-dev@xxxxxxxxxxxxx >> Cc: nios2-dev@xxxxxxxxxxxxxxxxxxxxxx >> Cc: linuxppc-dev@xxxxxxxxxxxxxxxx >> Cc: linux-s390@xxxxxxxxxxxxxxx >> Cc: linux-sh@xxxxxxxxxxxxxxx >> Cc: devel@xxxxxxxxxxxxxxxxxxxx >> Cc: linux-mm@xxxxxxxxx >> Cc: linux-kernel@xxxxxxxxxxxxxxx >> Signed-off-by: Anshuman Khandual <anshuman.khandual@xxxxxxx> > > Dunno. Such mask seems ok for testing flags, but it's a bit awkward when > initializing flags, where it covers just one of many combinations that seem > used. But no strong opinions, patch looks correct. Fair enough. The fact that it covers only one of the many init combinations used at various places, is indeed a good point. The page fault handlers does start with VMA flags mask as VM_ACCESS_FLAGS, hence will keep them and drop other init cases here.