From patchwork Tue Jul 31 06:01:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 10550031 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 46E5214E0 for ; Tue, 31 Jul 2018 06:07:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33CEA29E79 for ; Tue, 31 Jul 2018 06:07:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2619C2A40A; Tue, 31 Jul 2018 06:07:37 +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 767E729E79 for ; Tue, 31 Jul 2018 06:07:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A4E9D6B0010; Tue, 31 Jul 2018 02:07:35 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A00DF6B0266; Tue, 31 Jul 2018 02:07:35 -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 8C6816B0269; Tue, 31 Jul 2018 02:07:35 -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 2CA396B0010 for ; Tue, 31 Jul 2018 02:07:35 -0400 (EDT) Received: by mail-wr1-f70.google.com with SMTP id z16-v6so11041136wrs.22 for ; Mon, 30 Jul 2018 23:07:35 -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=ftJLmMXqG8CmVZdOaOowhe8RqP5KCxqnspoUayMMrlA=; b=gwJjZLTOyAEJapCu4BYRzgMRN5xVmTjkUmW5T4gHlHbPKAk1SoeC4/E0Jp98FWoZ2d n7a11dZ6SzSJbrI1DCA9BJuyibpUVCk7++XswHeUqGrQtoDcuRqmfULY3iyijxPyhbg3 9wRyglTZXIxxg6q/IJ6d7vrbl5F5zWVHCBL9T9q1L0Wx9WzjArCpdzyxKYfyiDP970I7 AYIX99fWjjI/e78hTO49cwcui/3UrMULfUFM9TnTSW3vuEep6+Hb1nxk+kQTlUqyXGoQ N2TNcYX1LWjCoF5+/RBRk6TFF0CxhxyIXT949QxR1TsrstvrvMHy31eFXUmp1PNjr1vE d0rw== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.197 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Gm-Message-State: AOUpUlEt7RLee1XJ7BLjdl9nKWZbxklV61f19iEm7EE5hPsnbJMSwggW hBuRiH+SD0bYYwn/cig2XXtpmaFzVZnJPKBpRy5TL7iDOqFSV05l0aCEVtt6RWQMNSRU18J90IV 83lNpmM0pbe/e90QhNkMz2LWoXpXCQayKKQuAdfDD9sor/PAobDIfT70Sf1Ic558= X-Received: by 2002:a5d:61ca:: with SMTP id q10-v6mr19817418wrv.33.1533017254752; Mon, 30 Jul 2018 23:07:34 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd4sat5KHQCugTI7KC0TalBuy7T0XdNezz5V8WMPncxwIVvOdAArLv5L+LRWtMHH7sml/5F X-Received: by 2002:a5d:61ca:: with SMTP id q10-v6mr19817379wrv.33.1533017253909; Mon, 30 Jul 2018 23:07:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533017253; cv=none; d=google.com; s=arc-20160816; b=j2M0zhlp2AbAmPbpyBHzyXRMxJmvHLTRsXo6Ts+akDf+rbU+PdoFvSmX9heoUY20F5 9iAs62Cyc+4CoBTf3Q332dJLe4XOqqN425Vz3CXaDtRojzDd94ItPqX4CdCDD+ItG8dZ OuyKEOPklTdq9OpfrW/40QRU0M+pN2CeTd9VPYh+OHy56OpN2UwFbQCGo/Sx4gvLb1t7 2DiJbTSEw1/7CxN1gm1BzhxumPmewQQkAuF6mj7i5HGhyGPrlwBBgolbBQwavZpHz7KK SgCafPwyEJ0xvgitHEIg6Zr5EuRxpeEK/X1Mq8djoWOUftaY4/Dmg+DnllM4lzgEp3ri c1wg== 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=ftJLmMXqG8CmVZdOaOowhe8RqP5KCxqnspoUayMMrlA=; b=iKd+hCH0KAL60DbWdbzl79n3z5l9R0MUDGDP0sa7SotKfOIAz6FlYIE8y45MGRIyQL jbsUwoKvliw7usgWelik/PohrugVyc10gu6/PxC8oczJ76SO4iyiJdxfr5rLOJQOPfAm nWZEZMsgpDLyiiNyqWJ0QdhV2Z8f1owCOTXstTL2a4Upbh2a+S0pyrHDPzQwQwepxT75 0clh+QwCRd01kerimjr6DnxajBXaWbN3mFvgN0S8J/anTp3y9XjVjvMw/ICK1e05mMlz j3WxBrtCXCDtTEkQtaC86HGPf2AYHJnB8lCI3id62t2CbHQp5PfTt/Degxmja+fy7ucF FgyQ== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 217.70.183.197 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net. [217.70.183.197]) by mx.google.com with ESMTPS id f42-v6si2045149wrf.336.2018.07.30.23.07.33 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jul 2018 23:07:33 -0700 (PDT) Received-SPF: neutral (google.com: 217.70.183.197 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) client-ip=217.70.183.197; Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.197 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 relay5-d.mail.gandi.net (Postfix) with ESMTPSA id CBE531C000E; Tue, 31 Jul 2018 06:07:24 +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 04/11] hugetlb: Introduce generic version of huge_ptep_get_and_clear Date: Tue, 31 Jul 2018 06:01:48 +0000 Message-Id: <20180731060155.16915-5-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.000007, 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 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 0794b53439d4..970101cf9c82 100644 --- a/arch/powerpc/include/asm/hugetlb.h +++ b/arch/powerpc/include/asm/hugetlb.h @@ -132,6 +132,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 */