diff options
author | Mel Gorman <mel@csn.ul.ie> | 2007-07-17 07:03:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-17 13:22:59 -0400 |
commit | 396faf0303d273219db5d7eb4a2879ad977ed185 (patch) | |
tree | 96cb64fd6713ef7a924f4f878e259aea781f079a /include | |
parent | 2a1e274acf0b1c192face19a4be7c12d4503eaaf (diff) |
Allow huge page allocations to use GFP_HIGH_MOVABLE
Huge pages are not movable so are not allocated from ZONE_MOVABLE. However,
as ZONE_MOVABLE will always have pages that can be migrated or reclaimed, it
can be used to satisfy hugepage allocations even when the system has been
running a long time. This allows an administrator to resize the hugepage pool
at runtime depending on the size of ZONE_MOVABLE.
This patch adds a new sysctl called hugepages_treat_as_movable. When a
non-zero value is written to it, future allocations for the huge page pool
will use ZONE_MOVABLE. Despite huge pages being non-movable, we do not
introduce additional external fragmentation of note as huge pages are always
the largest contiguous block we care about.
[akpm@linux-foundation.org: various fixes]
Signed-off-by: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/hugetlb.h | 2 | ||||
-rw-r--r-- | include/linux/mempolicy.h | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 2c13715e9dde..49b7053043ad 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
@@ -15,6 +15,7 @@ static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) | |||
15 | } | 15 | } |
16 | 16 | ||
17 | int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); | 17 | int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); |
18 | int hugetlb_treat_movable_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); | ||
18 | int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); | 19 | int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); |
19 | int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int); | 20 | int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int); |
20 | void unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long); | 21 | void unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long); |
@@ -29,6 +30,7 @@ int hugetlb_reserve_pages(struct inode *inode, long from, long to); | |||
29 | void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed); | 30 | void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed); |
30 | 31 | ||
31 | extern unsigned long max_huge_pages; | 32 | extern unsigned long max_huge_pages; |
33 | extern unsigned long hugepages_treat_as_movable; | ||
32 | extern const unsigned long hugetlb_zero, hugetlb_infinity; | 34 | extern const unsigned long hugetlb_zero, hugetlb_infinity; |
33 | extern int sysctl_hugetlb_shm_group; | 35 | extern int sysctl_hugetlb_shm_group; |
34 | 36 | ||
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h index daabb3aa1ec6..e147cf50529f 100644 --- a/include/linux/mempolicy.h +++ b/include/linux/mempolicy.h | |||
@@ -159,7 +159,7 @@ extern void mpol_fix_fork_child_flag(struct task_struct *p); | |||
159 | 159 | ||
160 | extern struct mempolicy default_policy; | 160 | extern struct mempolicy default_policy; |
161 | extern struct zonelist *huge_zonelist(struct vm_area_struct *vma, | 161 | extern struct zonelist *huge_zonelist(struct vm_area_struct *vma, |
162 | unsigned long addr); | 162 | unsigned long addr, gfp_t gfp_flags); |
163 | extern unsigned slab_node(struct mempolicy *policy); | 163 | extern unsigned slab_node(struct mempolicy *policy); |
164 | 164 | ||
165 | extern enum zone_type policy_zone; | 165 | extern enum zone_type policy_zone; |
@@ -256,9 +256,9 @@ static inline void mpol_fix_fork_child_flag(struct task_struct *p) | |||
256 | #define set_cpuset_being_rebound(x) do {} while (0) | 256 | #define set_cpuset_being_rebound(x) do {} while (0) |
257 | 257 | ||
258 | static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma, | 258 | static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma, |
259 | unsigned long addr) | 259 | unsigned long addr, gfp_t gfp_flags) |
260 | { | 260 | { |
261 | return NODE_DATA(0)->node_zonelists + gfp_zone(GFP_HIGHUSER); | 261 | return NODE_DATA(0)->node_zonelists + gfp_zone(gfp_flags); |
262 | } | 262 | } |
263 | 263 | ||
264 | static inline int do_migrate_pages(struct mm_struct *mm, | 264 | static inline int do_migrate_pages(struct mm_struct *mm, |