From 6befb4f40fdcb1c64296cfbcda8d3526b847b2a9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=BB=84=E6=B6=9B?= Date: Mon, 19 Sep 2011 12:04:27 +0800 Subject: [PATCH] mm: add _GFP_NO_KSWAPD flag commit 32dba98e085f8b2b4345887df9abf5e0e93bfc12 upstream. --- include/linux/gfp.h | 4 +++- 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 557bdad320b6..64d72e58f8e0 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -59,13 +59,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 e1881454831f..033218c33378 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1833,7 +1833,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 -- 2.34.1