mm/hugetlb: reduce arch dependent code about huge_pmd_unshare
authorZhang Zhen <zhenzhang.zhang@huawei.com>
Wed, 24 Jun 2015 23:56:13 +0000 (16:56 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 25 Jun 2015 00:49:41 +0000 (17:49 -0700)
Currently we have many duplicates in definitions of huge_pmd_unshare.  In
all architectures this function just returns 0 when
CONFIG_ARCH_WANT_HUGE_PMD_SHARE is N.

This patch puts the default implementation in mm/hugetlb.c and lets these
architectures use the common code.

Signed-off-by: Zhang Zhen <zhenzhang.zhang@huawei.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Chris Metcalf <cmetcalf@ezchip.com>
Cc: David Rientjes <rientjes@google.com>
Cc: James Yang <James.Yang@freescale.com>
Cc: Aneesh Kumar <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/arm/mm/hugetlbpage.c
arch/arm64/mm/hugetlbpage.c
arch/ia64/mm/hugetlbpage.c
arch/metag/mm/hugetlbpage.c
arch/mips/mm/hugetlbpage.c
arch/powerpc/mm/hugetlbpage.c
arch/s390/mm/hugetlbpage.c
arch/sh/mm/hugetlbpage.c
arch/sparc/mm/hugetlbpage.c
arch/tile/mm/hugetlbpage.c
mm/hugetlb.c

index c724124150934f3a196a1437f85abebc7c355bf4..fcafb521f14eddea24b0252b18ba7c16a62a614e 100644 (file)
@@ -41,11 +41,6 @@ int pud_huge(pud_t pud)
        return 0;
 }
 
-int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
-{
-       return 0;
-}
-
 int pmd_huge(pmd_t pmd)
 {
        return pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT);
index 2de9d2e59d96808325829a37bca559c2ddb48a1c..cccc4af87a0372976e25e16667143892562b3457 100644 (file)
 #include <asm/tlbflush.h>
 #include <asm/pgalloc.h>
 
-#ifndef CONFIG_ARCH_WANT_HUGE_PMD_SHARE
-int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
-{
-       return 0;
-}
-#endif
-
 int pmd_huge(pmd_t pmd)
 {
        return !(pmd_val(pmd) & PMD_TABLE_BIT);
index 52b7604b5215f899b0820bf6741618b5bc774dfa..f50d4b3f501ad6a5cd0fcf10dfd66b82500b0e54 100644 (file)
@@ -65,11 +65,6 @@ huge_pte_offset (struct mm_struct *mm, unsigned long addr)
        return pte;
 }
 
-int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
-{
-       return 0;
-}
-
 #define mk_pte_huge(entry) { pte_val(entry) |= _PAGE_P; }
 
 /*
index 7ca80ac42ed5a9ec13ce90ad291ed024594b819f..53f0f6c470273b9c7c48ad6976b3e526a929ed52 100644 (file)
@@ -89,11 +89,6 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
        return pte;
 }
 
-int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
-{
-       return 0;
-}
-
 int pmd_huge(pmd_t pmd)
 {
        return pmd_page_shift(pmd) > PAGE_SHIFT;
index 06e0f421b41b197b628b0f75cf8d7145eee9ba3a..74aa6f62468f2eb463372c58320cc5e7c69cc2fe 100644 (file)
@@ -51,11 +51,6 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
        return (pte_t *) pmd;
 }
 
-int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
-{
-       return 0;
-}
-
 /*
  * This function checks for proper alignment of input addr and len parameters.
  */
index 3385e3d0506ec575f3eeebad77d2c65264a3acf3..38bd5d998c81aadda711b03093a9b854e1018cc8 100644 (file)
@@ -439,11 +439,6 @@ int alloc_bootmem_huge_page(struct hstate *hstate)
 }
 #endif
 
-int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
-{
-       return 0;
-}
-
 #ifdef CONFIG_PPC_FSL_BOOK3E
 #define HUGEPD_FREELIST_SIZE \
        ((PAGE_SIZE - sizeof(struct hugepd_freelist)) / sizeof(pte_t))
index e617e74b7be22aade65168f2c103c32b18b18653..c3f8e3df92ff9de3dff55395d57541304487dfc2 100644 (file)
@@ -193,11 +193,6 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
        return (pte_t *) pmdp;
 }
 
-int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
-{
-       return 0;
-}
-
 int pmd_huge(pmd_t pmd)
 {
        if (!MACHINE_HAS_HPAGE)
index 534bc978af8a58f069709cfc95f5f8c02a1a1a50..6385f60209b65adefc2bbbcc8e5309a5d574455d 100644 (file)
@@ -62,11 +62,6 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
        return pte;
 }
 
-int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
-{
-       return 0;
-}
-
 int pmd_huge(pmd_t pmd)
 {
        return 0;
index 4242eab12e10738e8bdbf6117f7be26d45528a48..131eaf4ad7f598aacaaf31a8f59da9ad1335c2da 100644 (file)
@@ -172,11 +172,6 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
        return pte;
 }
 
-int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
-{
-       return 0;
-}
-
 void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
                     pte_t *ptep, pte_t entry)
 {
index 8416240c322c929f6becd672673e6316603173d0..c034dc3fe2d42cb80502517816dd188ff8801557 100644 (file)
@@ -160,11 +160,6 @@ int pud_huge(pud_t pud)
        return !!(pud_val(pud) & _PAGE_HUGE_PAGE);
 }
 
-int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
-{
-       return 0;
-}
-
 #ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA
 static unsigned long hugetlb_get_unmapped_area_bottomup(struct file *file,
                unsigned long addr, unsigned long len,
index 271e4432734c376baf0bf4b8953a38e391ac011c..716465ae57aa78eff121779cd45ada7fc63b2fbd 100644 (file)
@@ -3789,6 +3789,11 @@ pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud)
 {
        return NULL;
 }
+
+int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
+{
+       return 0;
+}
 #define want_pmd_share()       (0)
 #endif /* CONFIG_ARCH_WANT_HUGE_PMD_SHARE */