aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Arcangeli <aarcange@redhat.com>2011-01-13 18:46:49 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-13 20:32:41 -0500
commit32dba98e085f8b2b4345887df9abf5e0e93bfc12 (patch)
tree6789196797350911a1c370ce909bfde2556ccfc4
parent936a5fe6e6148c0b3ea0d792b903847d9b9931a1 (diff)
thp: _GFP_NO_KSWAPD
Transparent hugepage allocations must be allowed not to invoke kswapd or any other kind of indirect reclaim (especially when the defrag sysfs is control disabled). It's unacceptable to swap out anonymous pages (potentially anonymous transparent hugepages) in order to create new transparent hugepages. This is true for the MADV_HUGEPAGE areas too (swapping out a kvm virtual machine and so having it suffer an unbearable slowdown, so another one with guest physical memory marked MADV_HUGEPAGE can run 30% faster if it is running memory intensive workloads, makes no sense). If a transparent hugepage allocation fails the slowdown is minor and there is total fallback, so kswapd should never be asked to swapout memory to allow the high order allocation to succeed. Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Acked-by: Rik van Riel <riel@redhat.com> Acked-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>
-rw-r--r--include/linux/gfp.h5
-rw-r--r--mm/page_alloc.c3
2 files changed, 6 insertions, 2 deletions
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index f54adfcbec9c..49d2356bb82d 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -34,6 +34,7 @@ struct vm_area_struct;
34#else 34#else
35#define ___GFP_NOTRACK 0 35#define ___GFP_NOTRACK 0
36#endif 36#endif
37#define ___GFP_NO_KSWAPD 0x400000u
37 38
38/* 39/*
39 * GFP bitmasks.. 40 * GFP bitmasks..
@@ -81,13 +82,15 @@ struct vm_area_struct;
81#define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE) /* Page is reclaimable */ 82#define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE) /* Page is reclaimable */
82#define __GFP_NOTRACK ((__force gfp_t)___GFP_NOTRACK) /* Don't track with kmemcheck */ 83#define __GFP_NOTRACK ((__force gfp_t)___GFP_NOTRACK) /* Don't track with kmemcheck */
83 84
85#define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD)
86
84/* 87/*
85 * This may seem redundant, but it's a way of annotating false positives vs. 88 * This may seem redundant, but it's a way of annotating false positives vs.
86 * allocations that simply cannot be supported (e.g. page tables). 89 * allocations that simply cannot be supported (e.g. page tables).
87 */ 90 */
88#define __GFP_NOTRACK_FALSE_POSITIVE (__GFP_NOTRACK) 91#define __GFP_NOTRACK_FALSE_POSITIVE (__GFP_NOTRACK)
89 92
90#define __GFP_BITS_SHIFT 22 /* Room for 22 __GFP_FOO bits */ 93#define __GFP_BITS_SHIFT 23 /* Room for 23 __GFP_FOO bits */
91#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) 94#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
92 95
93/* This equals 0, but use constants in case they ever change */ 96/* This equals 0, but use constants in case they ever change */
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 6e62d5f9d40b..bbd0423f2820 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2027,7 +2027,8 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
2027 goto nopage; 2027 goto nopage;
2028 2028
2029restart: 2029restart:
2030 wake_all_kswapd(order, zonelist, high_zoneidx, 2030 if (!(gfp_mask & __GFP_NO_KSWAPD))
2031 wake_all_kswapd(order, zonelist, high_zoneidx,
2031 zone_idx(preferred_zone)); 2032 zone_idx(preferred_zone));
2032 2033
2033 /* 2034 /*