From patchwork Tue Jul 31 06:01:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 10550023 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5589B1708 for ; Tue, 31 Jul 2018 06:06:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4401529E79 for ; Tue, 31 Jul 2018 06:06:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 366442A40A; Tue, 31 Jul 2018 06:06:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F90429E79 for ; Tue, 31 Jul 2018 06:06:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9DADF6B000D; Tue, 31 Jul 2018 02:06:26 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 988426B000E; Tue, 31 Jul 2018 02:06:26 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 852C26B0010; Tue, 31 Jul 2018 02:06:26 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by kanga.kvack.org (Postfix) with ESMTP id 268B96B000D for ; Tue, 31 Jul 2018 02:06:26 -0400 (EDT) Received: by mail-wr1-f70.google.com with SMTP id t10-v6so11049738wrs.17 for ; Mon, 30 Jul 2018 23:06:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=d2/U4BnIhgPjVHqnWxAcljToy+n42S4aRLnCPvxsOoE=; b=bHamI3vtQX6qkZziR+TVwt6B2HZSHgib4khEu4EAUjBN0i5gJ8ZTyXXxfpiFm3eY6e e6tsmLqlV19DfHJuygRvepUPZIdT0kwoDxN0lvn/UVulYqQ3tEhHKqsOmZhesK9whKN8 JaTtUD00zGhf+3/igO3xyT1ZVkSFHGgNhb+k7Op/hMjZFrNTEGTrV3EkhauDlZFUwoAQ X6m/Re9t0mkudpiNJ61s6Vxe/PpTqiX2wQnBtTZG1Joewt8/t7Na4CGT1pjlsSgdsYi2 RKdxB/DB7Tq7Q8D0ZfR0e/p3+/Sm102aWHck9zWAyg5eRH73fYzskdLTR54GWphIgFVu /dVg== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.195 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Gm-Message-State: AOUpUlEeJ30FhYyNvmDkbycXm7tVTYtMyLvlqDAF1C1I2yOTRLcWbiYK NJMjZh9V2sU9DPIRHcUM/pHullVY2Y5fIqDqhpoyM3TLCccXP+pn/JMr8a6Yxj36E7V1wkKkDQz LHar95SSEwftIAMWQW51wqGygCwvT3PRPHULA6wlpEgPx64QqvcZoddSG+fBO81g= X-Received: by 2002:a1c:98a:: with SMTP id 132-v6mr1315863wmj.86.1533017185610; Mon, 30 Jul 2018 23:06:25 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfZusR4f0krGJdYXlC6FBEYna0Tq2C0jgXaRUcYM8TlSqTPCiQkoJ0OhOPXCAZ5wXmOGWAc X-Received: by 2002:a1c:98a:: with SMTP id 132-v6mr1315834wmj.86.1533017184639; Mon, 30 Jul 2018 23:06:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533017184; cv=none; d=google.com; s=arc-20160816; b=s7OWMwSb6E24IPvAiRsmnzTHMU8FCnCZK55dTlrIBsq4WVUw9zpmeGZTJey/3FOnb/ 3mYI86Tt9Kygprtuvv3O7c3OZ/hUHfcaxnivmNtkQZYqVI2kSL8r5x2Ys1MhrCWCuMON 0NCRQi0vTyii91YXokYbqxkg9gZP6RDYLP+fCDsOzmQ1I33VvISJeIeAjAxNNrCfCpT3 AkOtK1dj8n3MmpkbgzJSKYX+C4tS3/VACJnhUfx0VrwBsnjUiC/QqKs4QQOfYRCb8lds l5W1xaeW41AxqZcD+vgugge8vRIt+PPSZVQ3+KjK+wxFS6jJo/VlGuzlG8j6TFIy2kgB qynQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=d2/U4BnIhgPjVHqnWxAcljToy+n42S4aRLnCPvxsOoE=; b=Es1Smcy/rAfKzWvtRX5bN2sfJnbWkDVBGY870+rjO2BjjtXJ4o6LyUAsm5+1QkaPKL pYuTmlmitWHZ+a9AAdnqEWLM6Bqbs7hgqCrDTymRDXdYX6CPnPW4Rm9CZNLPAzHoeiht /2TVyv9QKY3Qp/p4iWxIAiFCydet/t8gDmzz0/VqAxH33H7fzNYZj0vZXXUTDpmMAu9u tDzLh2/ceThGK1khq8ijcCVq8E4qROo3STdPafptTK22BFJhD4ZVyOQEmiRuv9Z6N1oP fBD8X0/ApVVURTsYx9NaSL/RXLLTglyFV+Sk4Cx1Cjk6mXOxe92Xf05+HuaKgAlwvzmy +kWg== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 217.70.183.195 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net. [217.70.183.195]) by mx.google.com with ESMTPS id k9-v6si1025528wmc.104.2018.07.30.23.06.24 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jul 2018 23:06:24 -0700 (PDT) Received-SPF: neutral (google.com: 217.70.183.195 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) client-ip=217.70.183.195; Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.195 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Originating-IP: 79.86.19.127 Received: from alex.numericable.fr (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id E01BE6000B; Tue, 31 Jul 2018 06:06:14 +0000 (UTC) From: Alexandre Ghiti To: linux-mm@kvack.org, mike.kravetz@oracle.com, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, tony.luck@intel.com, fenghua.yu@intel.com, ralf@linux-mips.org, paul.burton@mips.com, jhogan@kernel.org, jejb@parisc-linux.org, deller@gmx.de, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, ysato@users.sourceforge.jp, dalias@libc.org, davem@davemloft.net, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, linux-mips@linux-mips.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org Cc: Alexandre Ghiti Subject: [PATCH v5 03/11] hugetlb: Introduce generic version of set_huge_pte_at Date: Tue, 31 Jul 2018 06:01:47 +0000 Message-Id: <20180731060155.16915-4-alex@ghiti.fr> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180731060155.16915-1-alex@ghiti.fr> References: <20180731060155.16915-1-alex@ghiti.fr> 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: X-Virus-Scanned: ClamAV using ClamSMTP arm, ia64, mips, powerpc, sh, x86 architectures use the same version of set_huge_pte_at, so move this generic implementation into asm-generic/hugetlb.h. Signed-off-by: Alexandre Ghiti Reviewed-by: Mike Kravetz --- arch/arm/include/asm/hugetlb-3level.h | 6 ------ arch/arm64/include/asm/hugetlb.h | 1 + arch/ia64/include/asm/hugetlb.h | 6 ------ arch/mips/include/asm/hugetlb.h | 6 ------ arch/parisc/include/asm/hugetlb.h | 1 + arch/powerpc/include/asm/hugetlb.h | 6 ------ arch/sh/include/asm/hugetlb.h | 6 ------ arch/sparc/include/asm/hugetlb.h | 1 + arch/x86/include/asm/hugetlb.h | 6 ------ include/asm-generic/hugetlb.h | 8 +++++++- 10 files changed, 10 insertions(+), 37 deletions(-) diff --git a/arch/arm/include/asm/hugetlb-3level.h b/arch/arm/include/asm/hugetlb-3level.h index d4014fbe5ea3..398fb06e8207 100644 --- a/arch/arm/include/asm/hugetlb-3level.h +++ b/arch/arm/include/asm/hugetlb-3level.h @@ -37,12 +37,6 @@ static inline pte_t huge_ptep_get(pte_t *ptep) return retval; } -static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, - pte_t *ptep, pte_t pte) -{ - set_pte_at(mm, addr, ptep, pte); -} - static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) { diff --git a/arch/arm64/include/asm/hugetlb.h b/arch/arm64/include/asm/hugetlb.h index 4af1a800a900..874661a1dff1 100644 --- a/arch/arm64/include/asm/hugetlb.h +++ b/arch/arm64/include/asm/hugetlb.h @@ -60,6 +60,7 @@ static inline void arch_clear_hugepage_flags(struct page *page) extern pte_t arch_make_huge_pte(pte_t entry, struct vm_area_struct *vma, struct page *page, int writable); #define arch_make_huge_pte arch_make_huge_pte +#define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT extern void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte); extern int huge_ptep_set_access_flags(struct vm_area_struct *vma, diff --git a/arch/ia64/include/asm/hugetlb.h b/arch/ia64/include/asm/hugetlb.h index afe9fa4d969b..a235d6f60fb3 100644 --- a/arch/ia64/include/asm/hugetlb.h +++ b/arch/ia64/include/asm/hugetlb.h @@ -20,12 +20,6 @@ static inline int is_hugepage_only_range(struct mm_struct *mm, REGION_NUMBER((addr)+(len)-1) == RGN_HPAGE); } -static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, - pte_t *ptep, pte_t pte) -{ - set_pte_at(mm, addr, ptep, pte); -} - static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { diff --git a/arch/mips/include/asm/hugetlb.h b/arch/mips/include/asm/hugetlb.h index 53764050243e..8ea439041d5d 100644 --- a/arch/mips/include/asm/hugetlb.h +++ b/arch/mips/include/asm/hugetlb.h @@ -36,12 +36,6 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } -static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, - pte_t *ptep, pte_t pte) -{ - set_pte_at(mm, addr, ptep, pte); -} - static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { diff --git a/arch/parisc/include/asm/hugetlb.h b/arch/parisc/include/asm/hugetlb.h index 28c23b68d38d..77c8adbac7c3 100644 --- a/arch/parisc/include/asm/hugetlb.h +++ b/arch/parisc/include/asm/hugetlb.h @@ -4,6 +4,7 @@ #include +#define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte); diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h index a7d5c739df9b..0794b53439d4 100644 --- a/arch/powerpc/include/asm/hugetlb.h +++ b/arch/powerpc/include/asm/hugetlb.h @@ -132,12 +132,6 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } -static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, - pte_t *ptep, pte_t pte) -{ - set_pte_at(mm, addr, ptep, pte); -} - static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { diff --git a/arch/sh/include/asm/hugetlb.h b/arch/sh/include/asm/hugetlb.h index f6a51b609409..bc552e37c1c9 100644 --- a/arch/sh/include/asm/hugetlb.h +++ b/arch/sh/include/asm/hugetlb.h @@ -25,12 +25,6 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } -static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, - pte_t *ptep, pte_t pte) -{ - set_pte_at(mm, addr, ptep, pte); -} - static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { diff --git a/arch/sparc/include/asm/hugetlb.h b/arch/sparc/include/asm/hugetlb.h index 59d89b52ccb7..16b0c53ea6c9 100644 --- a/arch/sparc/include/asm/hugetlb.h +++ b/arch/sparc/include/asm/hugetlb.h @@ -12,6 +12,7 @@ struct pud_huge_patch_entry { extern struct pud_huge_patch_entry __pud_huge_patch, __pud_huge_patch_end; #endif +#define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte); diff --git a/arch/x86/include/asm/hugetlb.h b/arch/x86/include/asm/hugetlb.h index 398da3b3414c..8db9a761964d 100644 --- a/arch/x86/include/asm/hugetlb.h +++ b/arch/x86/include/asm/hugetlb.h @@ -28,12 +28,6 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } -static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, - pte_t *ptep, pte_t pte) -{ - set_pte_at(mm, addr, ptep, pte); -} - static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h index c697ca9dda18..ee010b756246 100644 --- a/include/asm-generic/hugetlb.h +++ b/include/asm-generic/hugetlb.h @@ -47,8 +47,14 @@ static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb, { free_pgd_range(tlb, addr, end, floor, ceiling); } +#endif - +#ifndef __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT +static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, + pte_t *ptep, pte_t pte) +{ + set_pte_at(mm, addr, ptep, pte); +} #endif #endif /* _ASM_GENERIC_HUGETLB_H */