Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp3650081ybf; Tue, 3 Mar 2020 09:47:19 -0800 (PST) X-Google-Smtp-Source: ADFU+vsK/s3K8HA+GaJ9pEyLm9A/4pWAzfza9rCsFj2J+45/3eFSzEL+QJoWBMyG69XpgHFRRYoG X-Received: by 2002:aca:cc4b:: with SMTP id c72mr3377094oig.139.1583257631554; Tue, 03 Mar 2020 09:47:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583257631; cv=none; d=google.com; s=arc-20160816; b=KRvlVSiMASlyXb/+vVA7A8HODJ0rSSOa+ixj6cEmPNUTmkOOUKJHSQooIR4wjovJoX oQiugKdjrWPhMtVskhHoU6RDICK95ISqTPRqZexNccNmf52yn2hkJqDKKoRSJeW4UksT oatReBBs7VljI+9SCGw19v/490Q1b/7T5fyhiosIZAj9AzzUfLTV4pualN2HmiMa5u79 8TdZIrYWRqliFiaKa8GqyvcqXp2kVfXQrStqmnzSos/OXVJCnUFFbaOfkunotT+YX6OL z2N3DMApk8vcTuRi8um8yZasZJUfMJuaCy7bhb4HyzHnJYgdQakEbPjNpzLcEI2RBkmn m3TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=LGj/4Ngdidz3j9hoWEq0ozFcQVED1dXYgkvl4Gtzsks=; b=rLeAOAgl+JDS4xF43cEsXbEJilhfQfyzTv85iFBdlgjHdO5zvEgUkukY51C22ae6br MPIcK+H1NSdiaVHeSytNOjjrYPunQltXw2MQhLs84b6ehMHlL0qqCxAqkRgXmbk5uG9S xxOv83QNJbs1SKUe4patDphT80T2ZHLPRyopccPOUTiE00AOuBMSmAOJWK3Kab8x/KWL dK6AMVbHal0muSNi7O9Z8efgt3ig1YgJAB6PaiBjoHrXzADVIscb9PYmtt7Il5CWAVeB wy6E4CUYuQccgqh4vnjkcDLygfZPL+ZQrNTqViUJ0jczY4Tfvv4iTjr22s9ipXLeHkJD O6IQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h16si8268137otk.193.2020.03.03.09.46.59; Tue, 03 Mar 2020 09:47:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730274AbgCCRZZ (ORCPT + 99 others); Tue, 3 Mar 2020 12:25:25 -0500 Received: from mx2.suse.de ([195.135.220.15]:41142 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728242AbgCCRZY (ORCPT ); Tue, 3 Mar 2020 12:25:24 -0500 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >