Commit 8edf344c66a3f214d709dad1421c29d678915b3f

Authored by Naoya Horiguchi
Committed by Andi Kleen
1 parent 9fe6206f40

hugetlb: move definition of is_vm_hugetlb_page() to hugepage_inline.h

is_vm_hugetlb_page() is a widely used inline function to insert hooks
into hugetlb code.
But we can't use it in pagemap.h because of circular dependency of
the header files. This patch removes this limitation.

Acked-by: Mel Gorman <mel@csn.ul.ie>
Acked-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>

Showing 3 changed files with 24 additions and 10 deletions Side-by-side Diff

include/linux/hugetlb.h
... ... @@ -2,6 +2,7 @@
2 2 #define _LINUX_HUGETLB_H
3 3  
4 4 #include <linux/fs.h>
  5 +#include <linux/hugetlb_inline.h>
5 6  
6 7 struct ctl_table;
7 8 struct user_struct;
... ... @@ -14,11 +15,6 @@
14 15  
15 16 int PageHuge(struct page *page);
16 17  
17   -static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
18   -{
19   - return vma->vm_flags & VM_HUGETLB;
20   -}
21   -
22 18 void reset_vma_resv_huge_pages(struct vm_area_struct *vma);
23 19 int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
24 20 int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
... ... @@ -73,11 +69,6 @@
73 69 #else /* !CONFIG_HUGETLB_PAGE */
74 70  
75 71 static inline int PageHuge(struct page *page)
76   -{
77   - return 0;
78   -}
79   -
80   -static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
81 72 {
82 73 return 0;
83 74 }
include/linux/hugetlb_inline.h
  1 +#ifndef _LINUX_HUGETLB_INLINE_H
  2 +#define _LINUX_HUGETLB_INLINE_H 1
  3 +
  4 +#ifdef CONFIG_HUGETLBFS
  5 +
  6 +#include <linux/mm.h>
  7 +
  8 +static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
  9 +{
  10 + return vma->vm_flags & VM_HUGETLB;
  11 +}
  12 +
  13 +#else
  14 +
  15 +static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
  16 +{
  17 + return 0;
  18 +}
  19 +
  20 +#endif
  21 +
  22 +#endif
include/linux/pagemap.h
... ... @@ -13,6 +13,7 @@
13 13 #include <linux/gfp.h>
14 14 #include <linux/bitops.h>
15 15 #include <linux/hardirq.h> /* for in_interrupt() */
  16 +#include <linux/hugetlb_inline.h>
16 17  
17 18 /*
18 19 * Bits in mapping->flags. The lower __GFP_BITS_SHIFT bits are the page