From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 237F7C3F2D7 for ; Tue, 3 Mar 2020 17:25:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CC68220866 for ; Tue, 3 Mar 2020 17:25:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CC68220866 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 443696B0005; Tue, 3 Mar 2020 12:25:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3F3E76B0006; Tue, 3 Mar 2020 12:25:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 309F46B0007; Tue, 3 Mar 2020 12:25:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0116.hostedemail.com [216.40.44.116]) by kanga.kvack.org (Postfix) with ESMTP id 0C4366B0005 for ; Tue, 3 Mar 2020 12:25:25 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 7A1EA181AEF09 for ; Tue, 3 Mar 2020 17:25:24 +0000 (UTC) X-FDA: 76554727368.16.skin81_2f206f4d74c5e X-HE-Tag: skin81_2f206f4d74c5e X-Filterd-Recvd-Size: 6581 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Tue, 3 Mar 2020 17:25:23 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id BED26ACB8; Tue, 3 Mar 2020 17:25:16 +0000 (UTC) Subject: Re: [RFC 1/3] mm/vma: Define a default value for VM_DATA_DEFAULT_FLAGS To: Anshuman Khandual , linux-mm@kvack.org Cc: Richard Henderson , Vineet Gupta , Russell King , Catalin Marinas , Mark Salter , Guo Ren , Yoshinori Sato , Brian Cain , Tony Luck , Geert Uytterhoeven , Michal Simek , Ralf Baechle , Paul Burton , Nick Hu , Ley Foon Tan , Jonas Bonn , "James E.J. Bottomley" , Michael Ellerman , Paul Walmsley , Heiko Carstens , Rich Felker , "David S. Miller" , Guan Xuetao , Thomas Gleixner , Jeff Dike , Chris Zankel , Andrew Morton , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org, uclinux-h8-devel@lists.sourceforge.jp, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, nios2-dev@lists.rocketboards.org, openrisc@lists.librecores.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, linux-xtensa@linux-xtensa.org References: <1583131666-15531-1-git-send-email-anshuman.khandual@arm.com> <1583131666-15531-2-git-send-email-anshuman.khandual@arm.com> From: Vlastimil Babka Message-ID: Date: Tue, 3 Mar 2020 18:25:06 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <1583131666-15531-2-git-send-email-anshuman.khandual@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 > Cc: Vineet Gupta > Cc: Russell King > Cc: Catalin Marinas > Cc: Mark Salter > Cc: Guo Ren > Cc: Yoshinori Sato > Cc: Brian Cain > Cc: Tony Luck > Cc: Geert Uytterhoeven > Cc: Michal Simek > Cc: Ralf Baechle > Cc: Paul Burton > Cc: Nick Hu > Cc: Ley Foon Tan > Cc: Jonas Bonn > Cc: "James E.J. Bottomley" > Cc: Michael Ellerman > Cc: Paul Walmsley > Cc: Heiko Carstens > Cc: Rich Felker > Cc: "David S. Miller" > Cc: Guan Xuetao > Cc: Thomas Gleixner > Cc: Jeff Dike > Cc: Chris Zankel > Cc: Andrew Morton > Cc: linux-alpha@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Cc: linux-snps-arc@lists.infradead.org > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-c6x-dev@linux-c6x.org > Cc: uclinux-h8-devel@lists.sourceforge.jp > Cc: linux-hexagon@vger.kernel.org > Cc: linux-ia64@vger.kernel.org > Cc: linux-m68k@lists.linux-m68k.org > Cc: linux-mips@vger.kernel.org > Cc: nios2-dev@lists.rocketboards.org > Cc: openrisc@lists.librecores.org > Cc: linux-parisc@vger.kernel.org > Cc: linuxppc-dev@lists.ozlabs.org > Cc: linux-riscv@lists.infradead.org > Cc: linux-s390@vger.kernel.org > Cc: linux-sh@vger.kernel.org > Cc: sparclinux@vger.kernel.org > Cc: linux-um@lists.infradead.org > Cc: linux-xtensa@linux-xtensa.org > Cc: linux-mm@kvack.org > Signed-off-by: Anshuman Khandual 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. > +#endif > + > #ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ > #define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS > #endif >