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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EA7EC43334 for ; Mon, 20 Jun 2022 04:14:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7ADD16B0071; Mon, 20 Jun 2022 00:14:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 737806B0073; Mon, 20 Jun 2022 00:14:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5D7676B0074; Mon, 20 Jun 2022 00:14:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 4A6BA6B0071 for ; Mon, 20 Jun 2022 00:14:41 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 205523444B for ; Mon, 20 Jun 2022 04:14:41 +0000 (UTC) X-FDA: 79597297962.14.0FA4922 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf02.hostedemail.com (Postfix) with ESMTP id 1812B8009F for ; Mon, 20 Jun 2022 04:14:39 +0000 (UTC) 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 273441042; Sun, 19 Jun 2022 21:14:39 -0700 (PDT) Received: from [192.168.0.110] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 92A4F3F7D7; Sun, 19 Jun 2022 21:14:36 -0700 (PDT) Message-ID: <8da7bf08-0234-2d57-afb0-012b94fd8889@arm.com> Date: Mon, 20 Jun 2022 09:44:27 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH V3 2/2] mm/mmap: Drop generic protection_map[] array Content-Language: en-US To: "hch@infradead.org" , Christophe Leroy Cc: "linux-mm@kvack.org" , Andrew Morton , "linux-kernel@vger.kernel.org" , kernel test robot , Christoph Hellwig References: <20220616040924.1022607-1-anshuman.khandual@arm.com> <20220616040924.1022607-3-anshuman.khandual@arm.com> <7cf922f4-2367-e173-0280-cb498391d9f7@csgroup.eu> <7c72a97f-d7d4-db27-faa5-fec01673cca7@arm.com> <43205917-0517-4e45-6fbf-4fc849fb0325@csgroup.eu> From: Anshuman Khandual In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655698480; a=rsa-sha256; cv=none; b=3KYuzyAMTRD8S7dIiZMPOuut15xRGmMLiwChNKCGDojhSMdscoDhBtqGoLPYESa8uu/2Qh s7SNgm+5L2eYz52WGDmNw4w3imjyEBiO5QGDr0JejjaKra+PwT2YJdHYAfwnAkws5SIF1Y MGmdmXIt9ekyztMZPWa6Phh7jFVbhDY= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; spf=pass (imf02.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655698480; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TXZ1i7GgQyPoFD/TEd1xkzp2ncUf+UfqHYKOgjSYfQs=; b=1nXdmmVAAjT+a7eD+he5lpIQXfCbZ0Yl7Z3yDSE2V2VVpDDSE/QrCVyTSHMDrX74jakbRN tEIgR5xg6yQtqmcK9/5r+QRcOo63zbEyxWAKnV6d+SmQ83zZjZ8a3WmGbF99qcv+ssaWHi 3UPzpxzeDTYu04X27NYybQPu+1Re6fo= X-Stat-Signature: j3it3554ph7xz45yhodicq4as5ewynjp X-Rspamd-Queue-Id: 1812B8009F Authentication-Results: imf02.hostedemail.com; dkim=none; spf=pass (imf02.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com; dmarc=pass (policy=none) header.from=arm.com X-Rspamd-Server: rspam07 X-Rspam-User: X-HE-Tag: 1655698479-105254 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 6/17/22 13:30, hch@infradead.org wrote: > On Fri, Jun 17, 2022 at 05:48:11AM +0000, Christophe Leroy wrote: >> Is it a good idea to duplicate vm_get_page_prot() in each architecture ? > > It is a completely trivial array index. And I really like the idea > of not having the protection_map in common code - it really is an > implementation detail. But what we could do is something like > > #define DECLARE_VM_GET_PAGE_PROT \ > pgprot_t vm_get_page_prot(unsigned long vm_flags) \ > { \ > return protection_map[vm_flags & \ > (VM_READ | VM_WRITE | VM_EXEC | VM_SHARED)]; \ > } \ > EXPORT_SYMBOL(vm_get_page_prot); > > as a helper for the architectures. Agreed, this will ensure the exact same implementation for all platforms (except those custom vm_get_page_prot), without deviations and mistakes.