Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp229598imm; Wed, 4 Jul 2018 22:28:43 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfCqseeDcxsQe/MAVXB8Vyv4eeViER9ovTGVpER3+LHaEcs3p5GTQDAiRQRcBZ7ohtsvpg5 X-Received: by 2002:a17:902:46e:: with SMTP id 101-v6mr4741125ple.39.1530768523802; Wed, 04 Jul 2018 22:28:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530768523; cv=none; d=google.com; s=arc-20160816; b=olG7HZnUVv06FNPUvIOphJuGsFWHzHuZNYR/+8+lLdBmg9APARrzcIPX8nXZObCuRP lhxGZepPKU5lwbHZOoJw2HqeQxmo4s/tHdXYWd2VuXZXhahUXdcWB1uIHJSdvBVCWYZU wBm0p02pYAsK17TN/CL//CO5qwyJFVy5kpFQCwB+eOIVG2sU+4+QwsdB6te1OGfsHFQZ ma9KvZ4NnOgLa9jDq5mOfXNNqfvoyWljggAz0T5vSsTJCYcFJmkatrXyQPCl3/Duobzg fL+O73793oBcvaN+nokABmqEMKd8G7oo5zZZQWy7Mkib0OnFsaNkUf9Oop76uKtGh6Sn ipjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=Rs12aUtEH7Uupwevmhq9qJ8DPbpBnN71WE4YoT7TdAo=; b=r0dITWDTymXztYFtk9lBoFCJZd7aYGsavVWzbGcuU5r12alWJa1cWKrJMn9AyWa2Vg 2cupD9TQePy6T2VPzy05MELPN3L12zoc42cp5eYdySDqWj/g9Lpm1/c3/3pFB2bn5SF3 pi7H2ef0HgZ2H67qTGO7HvbKp8IhbinKo1npUgnrPMGET57JBUW4YamQMTg4+VQqkyth zBkD0mqYysAln5w6nrdheg08p6B8XP8FkAOPID5OnHfCAbIYCLxr0MP6rVwkGoW1mXvh Omx6pPW1jjAJvPwaMkDHEBDgms9PTW4w0Nq8cIgE9MomXvTvBEckyy9D9Dp0eBIHA6m/ 23yw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f8-v6si5017154pgf.166.2018.07.04.22.28.29; Wed, 04 Jul 2018 22:28:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753447AbeGEF1w (ORCPT + 99 others); Thu, 5 Jul 2018 01:27:52 -0400 Received: from mslow2.mail.gandi.net ([217.70.178.242]:60604 "EHLO slow1-d.mail.gandi.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752325AbeGEF1u (ORCPT ); Thu, 5 Jul 2018 01:27:50 -0400 Received: from relay10.mail.gandi.net (unknown [217.70.178.230]) by slow1-d.mail.gandi.net (Postfix) with ESMTP id A89D23A69DB; Thu, 5 Jul 2018 07:13:19 +0200 (CEST) Received: from alex.numericable.fr (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 87A60240009; Thu, 5 Jul 2018 05:13:12 +0000 (UTC) From: Alexandre Ghiti To: 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 v2 02/11] hugetlb: Introduce generic version of hugetlb_free_pgd_range Date: Thu, 5 Jul 2018 05:12:33 +0000 Message-Id: <20180705051242.694-2-alex@ghiti.fr> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180705051242.694-1-alex@ghiti.fr> References: <20180705050323.301-1-alex@ghiti.fr> <20180705051242.694-1-alex@ghiti.fr> X-Spam-Level: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org arm, arm64, mips, parisc, sh, x86 architectures use the same version of hugetlb_free_pgd_range, so move this generic implementation into asm-generic/hugetlb.h. Signed-off-by: Alexandre Ghiti --- arch/arm/include/asm/hugetlb.h | 12 ++---------- arch/arm64/include/asm/hugetlb.h | 10 ---------- arch/ia64/include/asm/hugetlb.h | 5 +++-- arch/mips/include/asm/hugetlb.h | 13 ++----------- arch/parisc/include/asm/hugetlb.h | 12 ++---------- arch/powerpc/include/asm/hugetlb.h | 4 +++- arch/sh/include/asm/hugetlb.h | 12 ++---------- arch/sparc/include/asm/hugetlb.h | 4 +++- arch/x86/include/asm/hugetlb.h | 11 ++--------- include/asm-generic/hugetlb.h | 11 +++++++++++ 10 files changed, 30 insertions(+), 64 deletions(-) diff --git a/arch/arm/include/asm/hugetlb.h b/arch/arm/include/asm/hugetlb.h index 7d26f6c4f0f5..047b893ef95d 100644 --- a/arch/arm/include/asm/hugetlb.h +++ b/arch/arm/include/asm/hugetlb.h @@ -23,19 +23,9 @@ #define _ASM_ARM_HUGETLB_H #include -#include #include -static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb, - unsigned long addr, unsigned long end, - unsigned long floor, - unsigned long ceiling) -{ - free_pgd_range(tlb, addr, end, floor, ceiling); -} - - static inline int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, unsigned long len) { @@ -68,4 +58,6 @@ static inline void arch_clear_hugepage_flags(struct page *page) clear_bit(PG_dcache_clean, &page->flags); } +#include + #endif /* _ASM_ARM_HUGETLB_H */ diff --git a/arch/arm64/include/asm/hugetlb.h b/arch/arm64/include/asm/hugetlb.h index 3fcf14663dfa..4af1a800a900 100644 --- a/arch/arm64/include/asm/hugetlb.h +++ b/arch/arm64/include/asm/hugetlb.h @@ -25,16 +25,6 @@ static inline pte_t huge_ptep_get(pte_t *ptep) return READ_ONCE(*ptep); } - - -static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb, - unsigned long addr, unsigned long end, - unsigned long floor, - unsigned long ceiling) -{ - free_pgd_range(tlb, addr, end, floor, ceiling); -} - static inline int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, unsigned long len) { diff --git a/arch/ia64/include/asm/hugetlb.h b/arch/ia64/include/asm/hugetlb.h index 74d2a5540aaf..afe9fa4d969b 100644 --- a/arch/ia64/include/asm/hugetlb.h +++ b/arch/ia64/include/asm/hugetlb.h @@ -3,9 +3,8 @@ #define _ASM_IA64_HUGETLB_H #include -#include - +#define __HAVE_ARCH_HUGETLB_FREE_PGD_RANGE void hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long addr, unsigned long end, unsigned long floor, unsigned long ceiling); @@ -70,4 +69,6 @@ static inline void arch_clear_hugepage_flags(struct page *page) { } +#include + #endif /* _ASM_IA64_HUGETLB_H */ diff --git a/arch/mips/include/asm/hugetlb.h b/arch/mips/include/asm/hugetlb.h index 982bc0685330..53764050243e 100644 --- a/arch/mips/include/asm/hugetlb.h +++ b/arch/mips/include/asm/hugetlb.h @@ -10,8 +10,6 @@ #define __ASM_HUGETLB_H #include -#include - static inline int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, @@ -38,15 +36,6 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } -static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb, - unsigned long addr, - unsigned long end, - unsigned long floor, - unsigned long ceiling) -{ - free_pgd_range(tlb, addr, end, floor, ceiling); -} - static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte) { @@ -114,4 +103,6 @@ static inline void arch_clear_hugepage_flags(struct page *page) { } +#include + #endif /* __ASM_HUGETLB_H */ diff --git a/arch/parisc/include/asm/hugetlb.h b/arch/parisc/include/asm/hugetlb.h index 58e0f4620426..28c23b68d38d 100644 --- a/arch/parisc/include/asm/hugetlb.h +++ b/arch/parisc/include/asm/hugetlb.h @@ -3,8 +3,6 @@ #define _ASM_PARISC64_HUGETLB_H #include -#include - void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte); @@ -32,14 +30,6 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } -static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb, - unsigned long addr, unsigned long end, - unsigned long floor, - unsigned long ceiling) -{ - free_pgd_range(tlb, addr, end, floor, ceiling); -} - static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) { @@ -71,4 +61,6 @@ static inline void arch_clear_hugepage_flags(struct page *page) { } +#include + #endif /* _ASM_PARISC64_HUGETLB_H */ diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h index 3225eb6402cc..de46ee16b615 100644 --- a/arch/powerpc/include/asm/hugetlb.h +++ b/arch/powerpc/include/asm/hugetlb.h @@ -4,7 +4,6 @@ #ifdef CONFIG_HUGETLB_PAGE #include -#include extern struct kmem_cache *hugepte_cache; @@ -113,6 +112,7 @@ static inline void flush_hugetlb_page(struct vm_area_struct *vma, void flush_hugetlb_page(struct vm_area_struct *vma, unsigned long vmaddr); #endif +#define __HAVE_ARCH_HUGETLB_FREE_PGD_RANGE void hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long addr, unsigned long end, unsigned long floor, unsigned long ceiling); @@ -193,4 +193,6 @@ static inline pte_t *hugepte_offset(hugepd_t hpd, unsigned long addr, } #endif /* CONFIG_HUGETLB_PAGE */ +#include + #endif /* _ASM_POWERPC_HUGETLB_H */ diff --git a/arch/sh/include/asm/hugetlb.h b/arch/sh/include/asm/hugetlb.h index 735939c0f513..f6a51b609409 100644 --- a/arch/sh/include/asm/hugetlb.h +++ b/arch/sh/include/asm/hugetlb.h @@ -4,8 +4,6 @@ #include #include -#include - static inline int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, @@ -27,14 +25,6 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } -static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb, - unsigned long addr, unsigned long end, - unsigned long floor, - unsigned long ceiling) -{ - free_pgd_range(tlb, addr, end, floor, ceiling); -} - static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte) { @@ -85,4 +75,6 @@ static inline void arch_clear_hugepage_flags(struct page *page) clear_bit(PG_dcache_clean, &page->flags); } +#include + #endif /* _ASM_SH_HUGETLB_H */ diff --git a/arch/sparc/include/asm/hugetlb.h b/arch/sparc/include/asm/hugetlb.h index 300557c66698..59d89b52ccb7 100644 --- a/arch/sparc/include/asm/hugetlb.h +++ b/arch/sparc/include/asm/hugetlb.h @@ -3,7 +3,6 @@ #define _ASM_SPARC64_HUGETLB_H #include -#include #ifdef CONFIG_HUGETLB_PAGE struct pud_huge_patch_entry { @@ -84,8 +83,11 @@ static inline void arch_clear_hugepage_flags(struct page *page) { } +#define __HAVE_ARCH_HUGETLB_FREE_PGD_RANGE void hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long addr, unsigned long end, unsigned long floor, unsigned long ceiling); +#include + #endif /* _ASM_SPARC64_HUGETLB_H */ diff --git a/arch/x86/include/asm/hugetlb.h b/arch/x86/include/asm/hugetlb.h index 5ed826da5e07..996ce8e15365 100644 --- a/arch/x86/include/asm/hugetlb.h +++ b/arch/x86/include/asm/hugetlb.h @@ -3,7 +3,6 @@ #define _ASM_X86_HUGETLB_H #include -#include #define hugepages_supported() boot_cpu_has(X86_FEATURE_PSE) @@ -28,14 +27,6 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } -static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb, - unsigned long addr, unsigned long end, - unsigned long floor, - unsigned long ceiling) -{ - free_pgd_range(tlb, addr, end, floor, ceiling); -} - static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte) { @@ -90,4 +81,6 @@ static inline void arch_clear_hugepage_flags(struct page *page) static inline bool gigantic_page_supported(void) { return true; } #endif +#include + #endif /* _ASM_X86_HUGETLB_H */ diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h index 3da7cff52360..c697ca9dda18 100644 --- a/include/asm-generic/hugetlb.h +++ b/include/asm-generic/hugetlb.h @@ -40,4 +40,15 @@ static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr, } #endif +#ifndef __HAVE_ARCH_HUGETLB_FREE_PGD_RANGE +static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb, + unsigned long addr, unsigned long end, + unsigned long floor, unsigned long ceiling) +{ + free_pgd_range(tlb, addr, end, floor, ceiling); +} + + +#endif + #endif /* _ASM_GENERIC_HUGETLB_H */ -- 2.16.2