From patchwork Thu Sep 29 22:29:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgecombe, Rick P" X-Patchwork-Id: 12994663 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 6B3DFC433F5 for ; Thu, 29 Sep 2022 22:30:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0C7138D0002; Thu, 29 Sep 2022 18:30:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 077E58D0001; Thu, 29 Sep 2022 18:30:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DBD578D0002; Thu, 29 Sep 2022 18:30:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id C96F18D0001 for ; Thu, 29 Sep 2022 18:30:05 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 9DD11140203 for ; Thu, 29 Sep 2022 22:30:05 +0000 (UTC) X-FDA: 79966567170.08.2EE37FF Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by imf12.hostedemail.com (Postfix) with ESMTP id CF7CA40010 for ; Thu, 29 Sep 2022 22:30:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664490604; x=1696026604; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=EMJDMBIIqSBkyZw8axj1oJhYe4QJUZ5xpfQW/D7WNF8=; b=XgMcTRNxrfnXq0TQMrmkGCxbF8OzdR26ii4iFT8ZjrTQ69SsHWGSa13k TuKamjNduRa1QBwrvQ6lKd2FPXP8HGGePkkOhGLhsLYmTojgMqYfIa8Bl YxU9jcrEBpSjsucBtPnDpnxsTYYODEZ4ms/eFpk4eN94t9lSjV8f9fr8v /rnzbcmnZt9i1Bxwu6Jg/UtOXDH6gi9UCj0rpS5LHv0aGYLiCEe2bQhxU ME/yYY8URTPNz5MBuhT+yK4uwaVYo7w7MpbDh+CLMqmlxu+mqpfYwfVeC esLmQT/GpIKelQG8zRZuxEWt6PFvrzxxU9DfstaPmCjVd9CaPCHY2FThz g==; X-IronPort-AV: E=McAfee;i="6500,9779,10485"; a="328420363" X-IronPort-AV: E=Sophos;i="5.93,356,1654585200"; d="scan'208";a="328420363" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2022 15:30:04 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10485"; a="691016153" X-IronPort-AV: E=Sophos;i="5.93,356,1654585200"; d="scan'208";a="691016153" Received: from sergungo-mobl.amr.corp.intel.com (HELO rpedgeco-desk.amr.corp.intel.com) ([10.251.25.88]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2022 15:30:02 -0700 From: Rick Edgecombe To: x86@kernel.org, "H . Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H . J . Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V . Shankar" , Weijiang Yang , "Kirill A . Shutemov" , joao.moreira@intel.com, John Allen , kcc@google.com, eranian@google.com, rppt@kernel.org, jamorris@linux.microsoft.com, dethoma@microsoft.com Cc: rick.p.edgecombe@intel.com, Yu-cheng Yu Subject: [PATCH v2 09/39] x86/mm: Move pmd_write(), pud_write() up in the file Date: Thu, 29 Sep 2022 15:29:06 -0700 Message-Id: <20220929222936.14584-10-rick.p.edgecombe@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220929222936.14584-1-rick.p.edgecombe@intel.com> References: <20220929222936.14584-1-rick.p.edgecombe@intel.com> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664490605; a=rsa-sha256; cv=none; b=X+yYAcBWDRku041YGJnpmC8OBkvWYXHh3BbmUKv3PzE7jIAzUVcCYQE4KPePhgmDCZqu3X Xs9ZfDCa/vTnr8hsrHHdB7XcjTdZCpQ9+dVYIN+1Qhc/fXrgKam1QrY1iMas5nxARDdTyc oKk6tPtbBPyCjKhO2qaZkTPkDdirdeM= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=XgMcTRNx; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf12.hostedemail.com: domain of rick.p.edgecombe@intel.com designates 192.55.52.88 as permitted sender) smtp.mailfrom=rick.p.edgecombe@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664490605; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references:dkim-signature; bh=sQaItF/InnS1iMhJqwSDM3wa0XHsPz05Q0poFreRGNk=; b=WnvgdvW1jGdm2C2agz3ogJHq2rfhY2WTKDtchi2hJoJOyUQQFr2S4C0aqeqifJyi1dUCV9 0evYAa85XXXf/bOd/PIfjGIDjV4yVBtmZ/VCgM1CRPA3BXWYB9SHb4C1/srNkbRHOFBiw1 4xk4rHlCewZPwZVY2EUdeyPZj8KRPKU= X-Rspamd-Queue-Id: CF7CA40010 X-Rspam-User: Authentication-Results: imf12.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=XgMcTRNx; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf12.hostedemail.com: domain of rick.p.edgecombe@intel.com designates 192.55.52.88 as permitted sender) smtp.mailfrom=rick.p.edgecombe@intel.com X-Rspamd-Server: rspam03 X-Stat-Signature: ah36iuu47ptzrftyo9subidwe1zpptgs X-HE-Tag: 1664490604-76936 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: From: Yu-cheng Yu To prepare the introduction of _PAGE_COW, move pmd_write() and pud_write() up in the file, so that they can be used by other helpers below. No functional changes. Signed-off-by: Yu-cheng Yu Reviewed-by: Kirill A. Shutemov Signed-off-by: Rick Edgecombe Reviewed-by: Kees Cook --- arch/x86/include/asm/pgtable.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 44e2d6f1dbaa..6496ec84b953 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -159,6 +159,18 @@ static inline int pte_write(pte_t pte) return pte_flags(pte) & _PAGE_RW; } +#define pmd_write pmd_write +static inline int pmd_write(pmd_t pmd) +{ + return pmd_flags(pmd) & _PAGE_RW; +} + +#define pud_write pud_write +static inline int pud_write(pud_t pud) +{ + return pud_flags(pud) & _PAGE_RW; +} + static inline int pte_huge(pte_t pte) { return pte_flags(pte) & _PAGE_PSE; @@ -1102,12 +1114,6 @@ extern int pmdp_clear_flush_young(struct vm_area_struct *vma, unsigned long address, pmd_t *pmdp); -#define pmd_write pmd_write -static inline int pmd_write(pmd_t pmd) -{ - return pmd_flags(pmd) & _PAGE_RW; -} - #define __HAVE_ARCH_PMDP_HUGE_GET_AND_CLEAR static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp) @@ -1137,12 +1143,6 @@ static inline void pmdp_set_wrprotect(struct mm_struct *mm, clear_bit(_PAGE_BIT_RW, (unsigned long *)pmdp); } -#define pud_write pud_write -static inline int pud_write(pud_t pud) -{ - return pud_flags(pud) & _PAGE_RW; -} - #ifndef pmdp_establish #define pmdp_establish pmdp_establish static inline pmd_t pmdp_establish(struct vm_area_struct *vma,