diff options
author | Andrea Arcangeli <aarcange@redhat.com> | 2010-08-02 20:41:20 +0200 |
---|---|---|
committer | Andrea Arcangeli <aarcange@redhat.com> | 2010-08-02 18:43:12 +0000 |
commit | 38c8a6820b3c161471ad32cb7d45e076ec3c5f9a (patch) | |
tree | 8e01ee3ada1c7553cd53f1d55f9c6a15c3e864ef | |
parent | 7a21204175e63f48fa9e7304f2afc486b9156e8d (diff) |
_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>
-rw-r--r-- | include/linux/gfp.h | 4 | ||||
-rw-r--r-- | mm/page_alloc.c | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 975609cb8548..da3a479228af 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -60,13 +60,15 @@ struct vm_area_struct; #define __GFP_NOTRACK ((__force gfp_t)0) #endif +#define __GFP_NO_KSWAPD ((__force gfp_t)0x400000u) + /* * This may seem redundant, but it's a way of annotating false positives vs. * allocations that simply cannot be supported (e.g. page tables). */ #define __GFP_NOTRACK_FALSE_POSITIVE (__GFP_NOTRACK) -#define __GFP_BITS_SHIFT 22 /* Room for 22 __GFP_FOO bits */ +#define __GFP_BITS_SHIFT 23 /* Room for 23 __GFP_FOO bits */ #define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) /* This equals 0, but use constants in case they ever change */ diff --git a/mm/page_alloc.c b/mm/page_alloc.c index ad54c2aed1fc..5423e8818b39 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1979,7 +1979,8 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, goto nopage; restart: - wake_all_kswapd(order, zonelist, high_zoneidx); + if (!(gfp_mask & __GFP_NO_KSWAPD)) + wake_all_kswapd(order, zonelist, high_zoneidx); /* * OK, we're below the kswapd watermark and have kicked background |