From patchwork Mon May 16 15:06:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mel Gorman X-Patchwork-Id: 95772 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id C5DDBB6EEC for ; Tue, 17 May 2011 01:08:02 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755996Ab1EPPHn (ORCPT ); Mon, 16 May 2011 11:07:43 -0400 Received: from cantor.suse.de ([195.135.220.2]:56515 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755770Ab1EPPHD (ORCPT ); Mon, 16 May 2011 11:07:03 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 7382994E22; Mon, 16 May 2011 17:07:02 +0200 (CEST) From: Mel Gorman To: Andrew Morton Cc: James Bottomley , Colin King , Raghavendra D Prabhu , Jan Kara , Chris Mason , Christoph Lameter , Pekka Enberg , Rik van Riel , Johannes Weiner , Minchan Kim , linux-fsdevel , linux-mm , linux-kernel , linux-ext4 , stable , Mel Gorman Subject: [PATCH 2/2] mm: vmscan: If kswapd has been running too long, allow it to sleep Date: Mon, 16 May 2011 16:06:57 +0100 Message-Id: <1305558417-24354-3-git-send-email-mgorman@suse.de> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1305558417-24354-1-git-send-email-mgorman@suse.de> References: <1305558417-24354-1-git-send-email-mgorman@suse.de> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Under constant allocation pressure, kswapd can be in the situation where sleeping_prematurely() will always return true even if kswapd has been running a long time. Check if kswapd needs to be scheduled. Signed-off-by: Mel Gorman Acked-by: Rik van Riel Acked-by: Johannes Weiner --- mm/vmscan.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index af24d1e..4d24828 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2251,6 +2251,10 @@ static bool sleeping_prematurely(pg_data_t *pgdat, int order, long remaining, unsigned long balanced = 0; bool all_zones_ok = true; + /* If kswapd has been running too long, just sleep */ + if (need_resched()) + return false; + /* If a direct reclaimer woke kswapd within HZ/10, it's premature */ if (remaining) return true;