diff mbox

[v3,02/11] hugetlb: Introduce generic version of hugetlb_free_pgd_range

Message ID 20180705051640.790-3-alex@ghiti.fr (mailing list archive)
State Awaiting Upstream
Headers show

Commit Message

Alexandre Ghiti July 5, 2018, 5:16 a.m. UTC
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 <alex@ghiti.fr>
---
 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(-)

Comments

kernel test robot July 5, 2018, 8:29 a.m. UTC | #1
Hi Alexandre,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.18-rc3 next-20180704]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Alexandre-Ghiti/hugetlb-Factorize-hugetlb-architecture-primitives/20180705-135909
config: powerpc-mpc8540_ads_defconfig (attached as .config)
compiler: powerpc-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=powerpc 

All error/warnings (new ones prefixed by >>):

   In file included from arch/powerpc/kernel/setup-common.c:37:0:
>> include/linux/hugetlb.h:191:65: error: expected identifier or '(' before '{' token
    #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; })
                                                                    ^
>> include/asm-generic/hugetlb.h:44:20: note: in expansion of macro 'hugetlb_free_pgd_range'
    static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb,
                       ^~~~~~~~~~~~~~~~~~~~~~

vim +191 include/linux/hugetlb.h

^1da177e Linus Torvalds    2005-04-16  172  
87ffc118 Andrea Arcangeli  2017-02-22  173  #define follow_hugetlb_page(m,v,p,vs,a,b,i,w,n)	({ BUG(); 0; })
^1da177e Linus Torvalds    2005-04-16  174  #define follow_huge_addr(mm, addr, write)	ERR_PTR(-EINVAL)
^1da177e Linus Torvalds    2005-04-16  175  #define copy_hugetlb_page_range(src, dst, vma)	({ BUG(); 0; })
e1759c21 Alexey Dobriyan   2008-10-15  176  static inline void hugetlb_report_meminfo(struct seq_file *m)
e1759c21 Alexey Dobriyan   2008-10-15  177  {
e1759c21 Alexey Dobriyan   2008-10-15  178  }
^1da177e Linus Torvalds    2005-04-16  179  #define hugetlb_report_node_meminfo(n, buf)	0
949f7ec5 David Rientjes    2013-04-29  180  static inline void hugetlb_show_meminfo(void)
949f7ec5 David Rientjes    2013-04-29  181  {
949f7ec5 David Rientjes    2013-04-29  182  }
4dc71451 Aneesh Kumar K.V  2017-07-06  183  #define follow_huge_pd(vma, addr, hpd, flags, pdshift) NULL
e66f17ff Naoya Horiguchi   2015-02-11  184  #define follow_huge_pmd(mm, addr, pmd, flags)	NULL
e66f17ff Naoya Horiguchi   2015-02-11  185  #define follow_huge_pud(mm, addr, pud, flags)	NULL
faaa5b62 Anshuman Khandual 2017-07-06  186  #define follow_huge_pgd(mm, addr, pgd, flags)	NULL
a5516438 Andi Kleen        2008-07-23  187  #define prepare_hugepage_range(file, addr, len)	(-EINVAL)
^1da177e Linus Torvalds    2005-04-16  188  #define pmd_huge(x)	0
ceb86879 Andi Kleen        2008-07-23  189  #define pud_huge(x)	0
^1da177e Linus Torvalds    2005-04-16  190  #define is_hugepage_only_range(mm, addr, len)	0
9da61aef David Gibson      2006-03-22 @191  #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; })
788c7df4 Hugh Dickins      2009-06-23  192  #define hugetlb_fault(mm, vma, addr, flags)	({ BUG(); 0; })
8fb5debc Mike Kravetz      2017-02-22  193  #define hugetlb_mcopy_atomic_pte(dst_mm, dst_pte, dst_vma, dst_addr, \
8fb5debc Mike Kravetz      2017-02-22  194  				src_addr, pagep)	({ BUG(); 0; })
7868a208 Punit Agrawal     2017-07-06  195  #define huge_pte_offset(mm, address, sz)	0
24669e58 Aneesh Kumar K.V  2012-07-31  196  

:::::: The code at line 191 was first introduced by commit
:::::: 9da61aef0fd5b17dd4bf4baf33db12c470def774 [PATCH] hugepage: Fix hugepage logic in free_pgtables()

:::::: TO: David Gibson <david@gibson.dropbear.id.au>
:::::: CC: Linus Torvalds <torvalds@g5.osdl.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Christophe Leroy July 5, 2018, 10:22 a.m. UTC | #2
On 07/05/2018 05:16 AM, Alexandre Ghiti wrote:
> 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 <alex@ghiti.fr>

Build failure on mpc885_ads_defconfig

   CC      arch/powerpc/kernel/setup-common.o
In file included from arch/powerpc/kernel/setup-common.c:37:
./include/linux/hugetlb.h:191:65: error: expected identifier or '(' 
before '{' token
  #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) 
({BUG(); 0; })
                                                                  ^
./include/asm-generic/hugetlb.h:44:20: note: in expansion of macro 
'hugetlb_free_pgd_range'
  static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb,
                     ^~~~~~~~~~~~~~~~~~~~~~

see below

> ---
>   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(-)
> 

[snip]

> 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 <asm/page.h>
> -#include <asm-generic/hugetlb.h>
>   
>   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 <asm-generic/hugetlb.h>
> +

That include was previously inside #ifdef CONFIG_HUGETLB_PAGE.
Why put it outside ?

Christophe

--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alexandre Ghiti July 5, 2018, 10:48 a.m. UTC | #3
My bad, when I moved the #include <asm-generic/hugeltb.h> at the bottom 
of the file, I did not pay attention to that #ifdef.
I'm going to fix powerpc and check other architectures if I did not make 
the same mistake.
I'll send a v4 as soon as possible.

Thanks for your comment,

Alex

On 07/05/2018 10:22 AM, Christophe Leroy wrote:
>
>
> On 07/05/2018 05:16 AM, Alexandre Ghiti wrote:
>> 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 <alex@ghiti.fr>
>
> Build failure on mpc885_ads_defconfig
>
>   CC      arch/powerpc/kernel/setup-common.o
> In file included from arch/powerpc/kernel/setup-common.c:37:
> ./include/linux/hugetlb.h:191:65: error: expected identifier or '(' 
> before '{' token
>  #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) 
> ({BUG(); 0; })
>                                                                  ^
> ./include/asm-generic/hugetlb.h:44:20: note: in expansion of macro 
> 'hugetlb_free_pgd_range'
>  static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb,
>                     ^~~~~~~~~~~~~~~~~~~~~~
>
> see below
>
>> ---
>>   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(-)
>>
>
> [snip]
>
>> 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 <asm/page.h>
>> -#include <asm-generic/hugetlb.h>
>>     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 <asm-generic/hugetlb.h>
>> +
>
> That include was previously inside #ifdef CONFIG_HUGETLB_PAGE.
> Why put it outside ?
>
> Christophe
>

--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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 <asm/page.h>
-#include <asm-generic/hugetlb.h>
 
 #include <asm/hugetlb-3level.h>
 
-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 <asm-generic/hugetlb.h>
+
 #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 <asm/page.h>
-#include <asm-generic/hugetlb.h>
-
 
+#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 <asm-generic/hugetlb.h>
+
 #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 <asm/page.h>
-#include <asm-generic/hugetlb.h>
-
 
 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 <asm-generic/hugetlb.h>
+
 #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 <asm/page.h>
-#include <asm-generic/hugetlb.h>
-
 
 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 <asm-generic/hugetlb.h>
+
 #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 <asm/page.h>
-#include <asm-generic/hugetlb.h>
 
 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 <asm-generic/hugetlb.h>
+
 #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 <asm/cacheflush.h>
 #include <asm/page.h>
-#include <asm-generic/hugetlb.h>
-
 
 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 <asm-generic/hugetlb.h>
+
 #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 <asm/page.h>
-#include <asm-generic/hugetlb.h>
 
 #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 <asm-generic/hugetlb.h>
+
 #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 <asm/page.h>
-#include <asm-generic/hugetlb.h>
 
 #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 <asm-generic/hugetlb.h>
+
 #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 */