From patchwork Tue Jul 31 06:01:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 10550015 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 B06841708 for ; Tue, 31 Jul 2018 06:05:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B9CF295B0 for ; Tue, 31 Jul 2018 06:05:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F4362A40A; Tue, 31 Jul 2018 06:05:18 +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 C9CF3295B0 for ; Tue, 31 Jul 2018 06:05:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 040606B000A; Tue, 31 Jul 2018 02:05:17 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id F09A86B000C; Tue, 31 Jul 2018 02:05:16 -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 DD1266B000D; Tue, 31 Jul 2018 02:05:16 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm0-f71.google.com (mail-wm0-f71.google.com [74.125.82.71]) by kanga.kvack.org (Postfix) with ESMTP id 7E5006B000A for ; Tue, 31 Jul 2018 02:05:16 -0400 (EDT) Received: by mail-wm0-f71.google.com with SMTP id f13-v6so944268wmb.4 for ; Mon, 30 Jul 2018 23:05:16 -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=0uST+XMKd0Si+s4oYG7j9OxqwyJ+iBkIUJD92u9UEvE=; b=QWgcnUbQvQM148d044jdOOY2AddOaFHh2qQSkr4y+/elqYc2ZaUkt8g+qMR72Et1uZ bSjk1MjEEIjMF6ZeXFGmutRu4H90LNTwWr4oASgUbFESPkqu6ckXxjGy9QUV4fYABJSF 2n3ZyICLbngsS+Se/lZJcw/bxDSqvqVdHuJQjj8auuW9Sxgf7yILXY+eHZX+a0XbgCW6 +6u/sIU+zmw3V9V1Xr7TVCy+FXq8T7AnxYPRilOlmjH019rN7HkwVNkLlk+yYutXkPEH H0wi2OaQAXlwvLwJ5IopWt7EGgaGtE/xfujPUTtxFGWIS0oTPjcLczPIItmi/jrqhPDJ CSsA== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.178.230 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Gm-Message-State: AOUpUlGWYIjtzXwJ8SAmTdmo+QiWyQevIlKses0sF4WJWE1RqeYyZ5OI k/TUZ+us12Ru9RtcSSOiQTc4Eyg1EWu49puc2My6kS2zYHPlyeDcKuxSkcYNtGTIpVVEtvZj33S GbrChMOmSmOUCiE0D6EiMXfrW3KjBFh3LNYTe8UNbID0XanLaGg5rDNC+S/XWHSc= X-Received: by 2002:a5d:550a:: with SMTP id b10-v6mr20620936wrv.228.1533017116019; Mon, 30 Jul 2018 23:05:16 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdYeuD1drJI4aoU5NhtUmDPHK1xq5t867ksw66w7/Wb9m+p68EHr9GEt5ovhZpoABWWa9BJ X-Received: by 2002:a5d:550a:: with SMTP id b10-v6mr20620879wrv.228.1533017114592; Mon, 30 Jul 2018 23:05:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533017114; cv=none; d=google.com; s=arc-20160816; b=oHhNRTCe2aq/f5tiSMi5wKr2lobhzSeE1fmiovzgxVWVqjHkNKF8d9XZSAyzfOt5CC 4rBiJ8+aCkTlWTNaGWk1BFCE+BOSDXJywV0aNC23pGJ50kT4e94aBXii0zgmp/o7YK5L 03PrdMKi7ELZ1B5wRgYCSEQRkwz3tpo6g7y4DE3jl4eGhFauyD8KNNTvXeGwwGWoBgUs YZHGB0D5L/1hdqWJsyc5d+50WjKuXer9YdrM01/Z+d2PEjvN+kZF+FCoB547gzsdckHL VNfqdRC4lY0u9eGazPq/G1uXmN/ruNX7wqE+v1gLYtn8/Lp7t73tWRsDJvUUd7db8HGg O1xA== 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=0uST+XMKd0Si+s4oYG7j9OxqwyJ+iBkIUJD92u9UEvE=; b=UPUTMROuztgclcE14If+Ggcy/cvVx6iyN/H4C/PP0hYNh6DftHDq34UJ3o8eeS46Y/ XJ8qSkvv9jtqBd88P0vuVwD+fqTs7AIZOkb6kuLjS51ljJ89UDqJLtQdnudFsgwFbUmv 8voyN8bIGC4s59IgTO/SgYqMqGsCxEqMTwihZ4XGAHiRsXJqa7MD2jA/nP7HrCMPePeu 8n+F32GPUbahY7+6r52JqIbypHG7Jwa7i9Ugyvj4Qi0FmzMHVGqmIT7mWKyy+HPmGtb7 ne95zKahNeL3Xibg2YdlRWRxpNOTbqzmP/mlye20wQxtNy3qh9w5HxIx8DZ/HNX+KQeU 8CPA== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 217.70.178.230 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from relay10.mail.gandi.net (relay10.mail.gandi.net. [217.70.178.230]) by mx.google.com with ESMTPS id q11-v6si8968884wrv.47.2018.07.30.23.05.14 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jul 2018 23:05:14 -0700 (PDT) Received-SPF: neutral (google.com: 217.70.178.230 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) client-ip=217.70.178.230; Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.178.230 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr 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 CEE4924000A; Tue, 31 Jul 2018 06:05:08 +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 02/11] hugetlb: Introduce generic version of hugetlb_free_pgd_range Date: Tue, 31 Jul 2018 06:01:46 +0000 Message-Id: <20180731060155.16915-3-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, 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 Reviewed-by: Mike Kravetz --- arch/arm/include/asm/hugetlb.h | 9 --------- 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 | 8 -------- include/asm-generic/hugetlb.h | 11 +++++++++++ 10 files changed, 26 insertions(+), 62 deletions(-) diff --git a/arch/arm/include/asm/hugetlb.h b/arch/arm/include/asm/hugetlb.h index 7d26f6c4f0f5..537660891f9f 100644 --- a/arch/arm/include/asm/hugetlb.h +++ b/arch/arm/include/asm/hugetlb.h @@ -27,15 +27,6 @@ #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) { 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..a7d5c739df9b 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); @@ -179,6 +179,8 @@ static inline void arch_clear_hugepage_flags(struct page *page) { } +#include + #else /* ! CONFIG_HUGETLB_PAGE */ static inline void flush_hugetlb_page(struct vm_area_struct *vma, unsigned long vmaddr) 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..398da3b3414c 100644 --- a/arch/x86/include/asm/hugetlb.h +++ b/arch/x86/include/asm/hugetlb.h @@ -28,14 +28,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) { 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 */