From patchwork Thu Sep 20 06:03:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 10606903 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 F2B2C5A4 for ; Thu, 20 Sep 2018 06:08:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0DBC2D1FA for ; Thu, 20 Sep 2018 06:08:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D413B2D200; Thu, 20 Sep 2018 06:08:43 +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 1C2452D1FA for ; Thu, 20 Sep 2018 06:08:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 432438E0006; Thu, 20 Sep 2018 02:08:42 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3E2B88E0001; Thu, 20 Sep 2018 02:08:42 -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 283F78E0006; Thu, 20 Sep 2018 02:08:42 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by kanga.kvack.org (Postfix) with ESMTP id BFF798E0001 for ; Thu, 20 Sep 2018 02:08:41 -0400 (EDT) Received: by mail-ed1-f69.google.com with SMTP id b4-v6so3682898ede.4 for ; Wed, 19 Sep 2018 23:08:41 -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=w6ekfLOlQT03XdLpMjhHLNbo63+NgedDLkJv8GgLaD4=; b=tTj0/4zzQYrL7Gha2PZmtsjpWj+XwGTQe6A+DPboKY007xyn0pOo/XENmnXr24ZF9j WcsxKLbBwCKeHVnrARWcg51LLDU5nW1+XciHfPNpdxKIA/NK9VQMNqqDYTwFl485rhlc lgpEbROyb4gbO+Bi1ho6xWt4eknL5azowbt5hN+lEI6vgSXE8iOi08Zi5Z2O3vQIhtg9 0fMZTaroEeDsJu1UUb9Y6kug2sEH902gxwVHARYhvHcc0o40c9i2qPEGPoUVgiSxWWvN MwTwTbNvLbWr8x6/ORTVuCTmeCCjJlcelPHSAzYQQZV0rbfxsbWqSpcNYUEV5bDUTzrN CQ/w== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.199 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Gm-Message-State: APzg51DqoM4VFTxnPvJhBANUNNCPEsW+j7OMbGNlBFa3QjZEVd79Kz2s 5VaJQYydVEjHg4QvZJSldhuhb3Ly1QDxVfaYC84GS4aS77x2eK4uqW3ziwhzs9CzkVxZkPRhzL7 LKYwiFNdMchibMiCgv73/isjRRvzxU9/RtJLi7wlIDosl7nx3Hj2SkIkwSDbqgRY= X-Received: by 2002:a50:9421:: with SMTP id p30-v6mr2118553eda.150.1537423721254; Wed, 19 Sep 2018 23:08:41 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYZM9kNFQDR1MbkzAN7HwZgOPcaeaTOjBektfoWbPLyoTj2ZQyjmMW6fxNUnMmbj2dBVJYn X-Received: by 2002:a50:9421:: with SMTP id p30-v6mr2118419eda.150.1537423719761; Wed, 19 Sep 2018 23:08:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537423719; cv=none; d=google.com; s=arc-20160816; b=ogcsmGxtCODb6/uQboAppEjpQBvGDVRSU8vo6WbjYzOR3nq7tzorn+hWcaQoedP4jp qem/IrwGfA0yb7tbYTXLM+V4EJm40cTPYzzQFAwzKXzAlWm2MlYMQ/rtPvOWc/zrMbtF cygitbVeVTa5lrPn7kGOGKiM0ZEG0OiUeKkLhKlACEsZNgOsIjfvLv4vt8zjXMSS7acj +V4gshHt5Mtp8e9oR1Be0tFb/uXdHhlQap8AEFf0pmurflB1Z/8s+M7SXmYeuJYoulRz 1flcWKvZf5WM3eRRf2iykczFzIAp0P8B/ks8CnAWQEE439JLSx+ltVXTmpaBehqPQi1E UwCQ== 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; bh=w6ekfLOlQT03XdLpMjhHLNbo63+NgedDLkJv8GgLaD4=; b=ZEc0kKkHiCp5sozO2CVQBpSwyH9NYSvXmjXaY3HL+lZMmzmKRKTGSw3qtm9PwAOzFB 1A+3B4VV5Miv+c4V+yyRmD90ubWUn5/KfbgnZXsou8zJSGfaBYMEVnMWKvQuC5ikIt0a i81Nu9NfASH0D1/xnElCoM1oZBSwsEkdvIGFR6kPNxiA874giXpI1UFIbCqYRf0+4M2S T+kxW8pw24enZsrjLwtOCVjEf6hl6Sp3P0rXMC37uIKvjYE9HVW2GzBqcQLPylJBdxLT CG49G5k18q40JJ92qTvPxBXiuHzsq/xGOJqltwTR/N2imvd0WFQJxh7ga6wMeBO3yWar TJFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 217.70.183.199 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net. [217.70.183.199]) by mx.google.com with ESMTPS id y43-v6si911388edd.416.2018.09.19.23.08.39 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Sep 2018 23:08:39 -0700 (PDT) Received-SPF: neutral (google.com: 217.70.183.199 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) client-ip=217.70.183.199; Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.199 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 relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 0C043FF808; Thu, 20 Sep 2018 06:08:33 +0000 (UTC) From: Alexandre Ghiti To: akpm@linux-foundation.org Cc: 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, Alexandre Ghiti Subject: [PATCH v7 04/11] hugetlb: Introduce generic version of huge_ptep_get_and_clear Date: Thu, 20 Sep 2018 06:03:51 +0000 Message-Id: <20180920060358.16606-5-alex@ghiti.fr> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180920060358.16606-1-alex@ghiti.fr> References: <20180920060358.16606-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, sh, x86 architectures use the same version of huge_ptep_get_and_clear, so move this generic implementation into asm-generic/hugetlb.h. Signed-off-by: Alexandre Ghiti Tested-by: Helge Deller # parisc Acked-by: Catalin Marinas # arm64 Acked-by: Paul Burton # MIPS parts Acked-by: Ingo Molnar # x86 Reviewed-by: Luiz Capitulino 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 | 1 + arch/parisc/include/asm/hugetlb.h | 1 + arch/powerpc/include/asm/hugetlb.h | 1 + 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, 13 insertions(+), 24 deletions(-) diff --git a/arch/arm/include/asm/hugetlb-3level.h b/arch/arm/include/asm/hugetlb-3level.h index 398fb06e8207..ad36e84b819a 100644 --- a/arch/arm/include/asm/hugetlb-3level.h +++ b/arch/arm/include/asm/hugetlb-3level.h @@ -49,12 +49,6 @@ static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, ptep_set_wrprotect(mm, addr, ptep); } -static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, - unsigned long addr, pte_t *ptep) -{ - return ptep_get_and_clear(mm, addr, ptep); -} - static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep, pte_t pte, int dirty) diff --git a/arch/arm64/include/asm/hugetlb.h b/arch/arm64/include/asm/hugetlb.h index 874661a1dff1..6ae0bcafe162 100644 --- a/arch/arm64/include/asm/hugetlb.h +++ b/arch/arm64/include/asm/hugetlb.h @@ -66,6 +66,7 @@ extern void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, extern int huge_ptep_set_access_flags(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep, pte_t pte, int dirty); +#define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR extern pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep); extern void huge_ptep_set_wrprotect(struct mm_struct *mm, diff --git a/arch/ia64/include/asm/hugetlb.h b/arch/ia64/include/asm/hugetlb.h index a235d6f60fb3..6719c74da0de 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 pte_t huge_ptep_get_and_clear(struct mm_struct *mm, - unsigned long addr, pte_t *ptep) -{ - return ptep_get_and_clear(mm, addr, ptep); -} - static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) { diff --git a/arch/mips/include/asm/hugetlb.h b/arch/mips/include/asm/hugetlb.h index 8ea439041d5d..0959cc5a41fa 100644 --- a/arch/mips/include/asm/hugetlb.h +++ b/arch/mips/include/asm/hugetlb.h @@ -36,6 +36,7 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } +#define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR 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 77c8adbac7c3..6e281e1bb336 100644 --- a/arch/parisc/include/asm/hugetlb.h +++ b/arch/parisc/include/asm/hugetlb.h @@ -8,6 +8,7 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte); +#define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep); diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h index 33b899624922..91bdc84b76ce 100644 --- a/arch/powerpc/include/asm/hugetlb.h +++ b/arch/powerpc/include/asm/hugetlb.h @@ -129,6 +129,7 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } +#define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR 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 bc552e37c1c9..08ee6c00b5e9 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 pte_t huge_ptep_get_and_clear(struct mm_struct *mm, - unsigned long addr, pte_t *ptep) -{ - return ptep_get_and_clear(mm, addr, ptep); -} - static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) { diff --git a/arch/sparc/include/asm/hugetlb.h b/arch/sparc/include/asm/hugetlb.h index 16b0c53ea6c9..944e3a4bfaff 100644 --- a/arch/sparc/include/asm/hugetlb.h +++ b/arch/sparc/include/asm/hugetlb.h @@ -16,6 +16,7 @@ extern struct pud_huge_patch_entry __pud_huge_patch, __pud_huge_patch_end; void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte); +#define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep); diff --git a/arch/x86/include/asm/hugetlb.h b/arch/x86/include/asm/hugetlb.h index 8db9a761964d..e9e7fef867ad 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 pte_t huge_ptep_get_and_clear(struct mm_struct *mm, - unsigned long addr, pte_t *ptep) -{ - return ptep_get_and_clear(mm, addr, ptep); -} - static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) { diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h index ee010b756246..0f6f151780dd 100644 --- a/include/asm-generic/hugetlb.h +++ b/include/asm-generic/hugetlb.h @@ -57,4 +57,12 @@ static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, } #endif +#ifndef __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR +static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, + unsigned long addr, pte_t *ptep) +{ + return ptep_get_and_clear(mm, addr, ptep); +} +#endif + #endif /* _ASM_GENERIC_HUGETLB_H */