Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4146808ybf; Tue, 3 Mar 2020 21:19:52 -0800 (PST) X-Google-Smtp-Source: ADFU+vuHYRp4UDyJ+1J+TaQcmVXbzZc1kpoEvzTNa+UvflJtTyJMVETfAdkjOFpC0nGpSfIdL0Kl X-Received: by 2002:aca:56ca:: with SMTP id k193mr645947oib.133.1583299192197; Tue, 03 Mar 2020 21:19:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583299192; cv=none; d=google.com; s=arc-20160816; b=LS6QU7ybBX89SPSHkHQhTj/jvlwpDxKx22xb0vdfxQfsmUi3cmGLMW5sQZD42IiX3D +chwHGLM6J5oh2/2QSbh0TiZAeps4fVIE3efHzTthoBT59p0VtWXx2XiE9ryYXQEl7MV oVH4e6bbTH3zoEK3W773ahcUyA1qsbcNaFj6ZDtDiB9B8cUYDiDl4eYbhinywKOVsHBv /Mo8u/QmLsLo9XctBcz1To+l0M7OurdZyVAGw2sC2tXU2+82HrmqEgY4MC+IFayEkgxu 3gZlFZf81jhNciT6O7REtX8d/t8NuXanrK2OLpjZrtj0B2yRVMZPAT59EEvdapAvm3MU ioRw== 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=4KDzSK80m6YmsGPn3+llWWQ9jLS3X/lPSiN8UhHCUGk=; b=ikE8iE7HmjPL9fcMZhztBhuoXuD5MwkZPy1VxKuStyUCKLEuU9YMJ92rthoxGM2S+X whMykBZ3JzOsHkEaln6/acSb8AA8N93GYTLLpCY38Vzdy3M454ZoKpjfaXyFXWV9DiyG tcCcd6/wbUJO9O2GL4CTYVnZ/7dLw8MBjY0H24es6W5igpu1UCV8Hj7F1GhkLrFf4+wt hzOUgg4StvxEphYc4ZT5FmAFQeUzEhJcCpFIXb5GKiqBydFSlKo0TStXy3hmmxKcpgoi mOjmiEocU34++LvkbuesaGVrD6sbQ/Tix2QiXA4mrf+eumXmJ2SExUMC7kvqSgYspIqc fcag== 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 n21si531424oic.0.2020.03.03.21.19.40; Tue, 03 Mar 2020 21:19:52 -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 S1725953AbgCDFTd (ORCPT + 99 others); Wed, 4 Mar 2020 00:19:33 -0500 Received: from foss.arm.com ([217.140.110.172]:55908 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725283AbgCDFTc (ORCPT ); Wed, 4 Mar 2020 00:19:32 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3EE0E31B; Tue, 3 Mar 2020 21:19:31 -0800 (PST) Received: from [10.163.1.88] (unknown [10.163.1.88]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5DDBA3F6CF; Tue, 3 Mar 2020 21:19:16 -0800 (PST) Subject: Re: [RFC 1/3] mm/vma: Define a default value for VM_DATA_DEFAULT_FLAGS To: Vlastimil Babka , 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: Anshuman Khandual Message-ID: <8b0f4c1b-f693-e139-4f66-ee4e1e88b95c@arm.com> Date: Wed, 4 Mar 2020 10:49:13 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: 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 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 >> 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 Reviewed-by: Vlastimil Babka > > 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 >> > > >