Skip to content

Commit 8edf344

Browse files
Naoya HoriguchiAndi Kleen
authored andcommitted
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 <[email protected]> Acked-by: Fengguang Wu <[email protected]> Signed-off-by: Naoya Horiguchi <[email protected]> Signed-off-by: Andi Kleen <[email protected]>
1 parent 9fe6206 commit 8edf344

File tree

3 files changed

+24
-10
lines changed

3 files changed

+24
-10
lines changed

include/linux/hugetlb.h

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define _LINUX_HUGETLB_H
33

44
#include <linux/fs.h>
5+
#include <linux/hugetlb_inline.h>
56

67
struct ctl_table;
78
struct user_struct;
@@ -14,11 +15,6 @@ struct user_struct;
1415

1516
int PageHuge(struct page *page);
1617

17-
static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
18-
{
19-
return vma->vm_flags & VM_HUGETLB;
20-
}
21-
2218
void reset_vma_resv_huge_pages(struct vm_area_struct *vma);
2319
int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
2420
int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
@@ -77,11 +73,6 @@ static inline int PageHuge(struct page *page)
7773
return 0;
7874
}
7975

80-
static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
81-
{
82-
return 0;
83-
}
84-
8576
static inline void reset_vma_resv_huge_pages(struct vm_area_struct *vma)
8677
{
8778
}

include/linux/hugetlb_inline.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/gfp.h>
1414
#include <linux/bitops.h>
1515
#include <linux/hardirq.h> /* for in_interrupt() */
16+
#include <linux/hugetlb_inline.h>
1617

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

0 commit comments

Comments
 (0)