Kyle McMartin 0983582
From linux-fsdevel-owner@vger.kernel.org Fri May 13 10:03:52 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 4/4] mm: vmscan: If kswapd has been running too long, allow it to sleep
Kyle McMartin 0983582
Date:	Fri, 13 May 2011 15:03:24 +0100
Kyle McMartin 0983582
Message-Id: <1305295404-12129-5-git-send-email-mgorman@suse.de>
Kyle McMartin 0983582
X-Mailing-List:	linux-fsdevel@vger.kernel.org
Kyle McMartin 0983582
Kyle McMartin 0983582
Under constant allocation pressure, kswapd can be in the situation where
Kyle McMartin 0983582
sleeping_prematurely() will always return true even if kswapd has been
Kyle McMartin 0983582
running a long time. Check if kswapd needs to be scheduled.
Kyle McMartin 0983582
Kyle McMartin 0983582
Signed-off-by: Mel Gorman <mgorman@suse.de>
Kyle McMartin 0983582
---
Kyle McMartin 0983582
 mm/vmscan.c |    4 ++++
Kyle McMartin 0983582
 1 files changed, 4 insertions(+), 0 deletions(-)
Kyle McMartin 0983582
Kyle McMartin 0983582
diff --git a/mm/vmscan.c b/mm/vmscan.c
Kyle McMartin 0983582
index af24d1e..4d24828 100644
Kyle McMartin 0983582
--- a/mm/vmscan.c
Kyle McMartin 0983582
+++ b/mm/vmscan.c
Kyle McMartin 0983582
@@ -2251,6 +2251,10 @@ static bool sleeping_prematurely(pg_data_t *pgdat, int order, long remaining,
Kyle McMartin 0983582
 	unsigned long balanced = 0;
Kyle McMartin 0983582
 	bool all_zones_ok = true;
Kyle McMartin 0983582
 
Kyle McMartin 0983582
+	/* If kswapd has been running too long, just sleep */
Kyle McMartin 0983582
+	if (need_resched())
Kyle McMartin 0983582
+		return false;
Kyle McMartin 0983582
+
Kyle McMartin 0983582
 	/* If a direct reclaimer woke kswapd within HZ/10, it's premature */
Kyle McMartin 0983582
 	if (remaining)
Kyle McMartin 0983582
 		return true;
Kyle McMartin 0983582
-- 
Kyle McMartin 0983582
1.7.3.4