From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752317Ab1LTGrz (ORCPT ); Tue, 20 Dec 2011 01:47:55 -0500 Received: from mail-qw0-f53.google.com ([209.85.216.53]:39207 "EHLO mail-qw0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750930Ab1LTGrt (ORCPT ); Tue, 20 Dec 2011 01:47:49 -0500 From: Minchan Kim To: Andrew Morton Cc: linux-mm , LKML , Minchan Kim , KOSAKI Motohiro , Mel Gorman , Rik van Riel , Johannes Weiner , Andrea Arcangeli Subject: [PATCH] consider swap space when we decide compaction goes or not Date: Tue, 20 Dec 2011 15:47:33 +0900 Message-Id: <1324363653-18220-1-git-send-email-minchan@kernel.org> X-Mailer: git-send-email 1.7.6.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It's pointless to go reclaiming when we have no swap space and lots of anon pages in inactive list. Cc: KOSAKI Motohiro Cc: Mel Gorman Cc: Rik van Riel Cc: Johannes Weiner Cc: Andrea Arcangeli Signed-off-by: Minchan Kim --- mm/vmscan.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 23256e8..cd5400c 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2015,8 +2015,9 @@ static inline bool should_continue_reclaim(struct zone *zone, * inactive lists are large enough, continue reclaiming */ pages_for_compaction = (2UL << sc->order); - inactive_lru_pages = zone_nr_lru_pages(zone, sc, LRU_INACTIVE_ANON) + - zone_nr_lru_pages(zone, sc, LRU_INACTIVE_FILE); + inactive_lru_pages = zone_nr_lru_pages(zone, sc, LRU_INACTIVE_FILE); + if (nr_swap_pages > 0) + inactive_lru_pages += zone_nr_lru_pages(zone, sc, LRU_INACTIVE_ANON); if (sc->nr_reclaimed < pages_for_compaction && inactive_lru_pages > pages_for_compaction) return true; -- 1.7.6.4