Skip to content

Commit

Permalink
hugetlb: move definition of is_vm_hugetlb_page() to hugepage_inline.h
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Naoya Horiguchi authored and Andi Kleen committed Aug 11, 2010
1 parent 9fe6206 commit 8edf344
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
11 changes: 1 addition & 10 deletions include/linux/hugetlb.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define _LINUX_HUGETLB_H

#include <linux/fs.h>
#include <linux/hugetlb_inline.h>

struct ctl_table;
struct user_struct;
Expand All @@ -14,11 +15,6 @@ struct user_struct;

int PageHuge(struct page *page);

static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
{
return vma->vm_flags & VM_HUGETLB;
}

void reset_vma_resv_huge_pages(struct vm_area_struct *vma);
int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
Expand Down Expand Up @@ -77,11 +73,6 @@ static inline int PageHuge(struct page *page)
return 0;
}

static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
{
return 0;
}

static inline void reset_vma_resv_huge_pages(struct vm_area_struct *vma)
{
}
Expand Down
22 changes: 22 additions & 0 deletions include/linux/hugetlb_inline.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef _LINUX_HUGETLB_INLINE_H
#define _LINUX_HUGETLB_INLINE_H 1

#ifdef CONFIG_HUGETLBFS

#include <linux/mm.h>

static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
{
return vma->vm_flags & VM_HUGETLB;
}

#else

static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
{
return 0;
}

#endif

#endif
1 change: 1 addition & 0 deletions include/linux/pagemap.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <linux/gfp.h>
#include <linux/bitops.h>
#include <linux/hardirq.h> /* for in_interrupt() */
#include <linux/hugetlb_inline.h>

/*
* Bits in mapping->flags. The lower __GFP_BITS_SHIFT bits are the page
Expand Down

0 comments on commit 8edf344

Please sign in to comment.