Kyle McMartin 0983582
From linux-fsdevel-owner@vger.kernel.org Fri May 13 10:04:00 2011
Kyle McMartin 0983582
From:	Mel Gorman <mgorman@suse.de>
Kyle McMartin 0983582
To:	Andrew Morton <akpm@linux-foundation.org>
Kyle McMartin 0983582
Cc:	James Bottomley <James.Bottomley@HansenPartnership.com>,
Kyle McMartin 0983582
	Colin King <colin.king@canonical.com>,
Kyle McMartin 0983582
	Raghavendra D Prabhu <raghu.prabhu13@gmail.com>,
Kyle McMartin 0983582
	Jan Kara <jack@suse.cz>, Chris Mason <chris.mason@oracle.com>,
Kyle McMartin 0983582
	Christoph Lameter <cl@linux.com>,
Kyle McMartin 0983582
	Pekka Enberg <penberg@kernel.org>,
Kyle McMartin 0983582
	Rik van Riel <riel@redhat.com>,
Kyle McMartin 0983582
	Johannes Weiner <hannes@cmpxchg.org>,
Kyle McMartin 0983582
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Kyle McMartin 0983582
	linux-mm <linux-mm@kvack.org>,
Kyle McMartin 0983582
	linux-kernel <linux-kernel@vger.kernel.org>,
Kyle McMartin 0983582
	linux-ext4 <linux-ext4@vger.kernel.org>,
Kyle McMartin 0983582
	Mel Gorman <mgorman@suse.de>
Kyle McMartin 0983582
Subject: [PATCH 2/4] mm: slub: Do not wake kswapd for SLUBs speculative high-order allocations
Kyle McMartin 0983582
Date:	Fri, 13 May 2011 15:03:22 +0100
Kyle McMartin 0983582
Message-Id: <1305295404-12129-3-git-send-email-mgorman@suse.de>
Kyle McMartin 0983582
X-Mailing-List:	linux-fsdevel@vger.kernel.org
Kyle McMartin a7e4f1c
Kyle McMartin a7e4f1c
To avoid locking and per-cpu overhead, SLUB optimisically uses
Kyle McMartin a7e4f1c
high-order allocations and falls back to lower allocations if they
Kyle McMartin a7e4f1c
fail.  However, by simply trying to allocate, kswapd is woken up to
Kyle McMartin a7e4f1c
start reclaiming at that order. On a desktop system, two users report
Kyle McMartin a7e4f1c
that the system is getting locked up with kswapd using large amounts
Kyle McMartin a7e4f1c
of CPU.  Using SLAB instead of SLUB made this problem go away.
Kyle McMartin a7e4f1c
Kyle McMartin a7e4f1c
This patch prevents kswapd being woken up for high-order allocations.
Kyle McMartin a7e4f1c
Testing indicated that with this patch applied, the system was much
Kyle McMartin a7e4f1c
harder to hang and even when it did, it eventually recovered.
Kyle McMartin a7e4f1c
Kyle McMartin a7e4f1c
Signed-off-by: Mel Gorman <mgorman@suse.de>
Kyle McMartin a7e4f1c
---
Kyle McMartin a7e4f1c
 mm/slub.c |    2 +-
Kyle McMartin a7e4f1c
 1 files changed, 1 insertions(+), 1 deletions(-)
Kyle McMartin a7e4f1c
Kyle McMartin a7e4f1c
diff --git a/mm/slub.c b/mm/slub.c
Kyle McMartin a7e4f1c
index 9d2e5e4..98c358d 100644
Kyle McMartin a7e4f1c
--- a/mm/slub.c
Kyle McMartin a7e4f1c
+++ b/mm/slub.c
Kyle McMartin a7e4f1c
@@ -1170,7 +1170,7 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
Kyle McMartin a7e4f1c
 	 * Let the initial higher-order allocation fail under memory pressure
Kyle McMartin a7e4f1c
 	 * so we fall-back to the minimum order allocation.
Kyle McMartin a7e4f1c
 	 */
Kyle McMartin a7e4f1c
-	alloc_gfp = (flags | __GFP_NOWARN | __GFP_NORETRY) & ~__GFP_NOFAIL;
Kyle McMartin a7e4f1c
+	alloc_gfp = (flags | __GFP_NOWARN | __GFP_NORETRY | __GFP_NO_KSWAPD) & ~__GFP_NOFAIL;
Kyle McMartin a7e4f1c
 
Kyle McMartin a7e4f1c
 	page = alloc_slab_page(alloc_gfp, node, oo);
Kyle McMartin a7e4f1c
 	if (unlikely(!page)) {
Kyle McMartin a7e4f1c
-- 
Kyle McMartin a7e4f1c
1.7.3.4