Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756846Ab1DZQZ4 (ORCPT ); Tue, 26 Apr 2011 12:25:56 -0400 Received: from mail-iw0-f174.google.com ([209.85.214.174]:60952 "EHLO mail-iw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756004Ab1DZQZx (ORCPT ); Tue, 26 Apr 2011 12:25:53 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=ThxVoADASwZn4UXcd4rVJUZx4jgSO4zMDft6j0WxOSSazLoXFyAJZK4y0BWoqz+39G cf3gX3gd3IvFEuqQn4bOJwWaiB6rD2UDZJaz5fq/lCHNyyCBn+pu4yuHtrYe80VEeicu d//3RPUbsFWc9pFVcHHEDxH/W9FM7kq0X5LJ8= From: Minchan Kim To: Andrew Morton Cc: linux-mm , LKML , Christoph Lameter , Johannes Weiner , KAMEZAWA Hiroyuki , Minchan Kim , KOSAKI Motohiro , Mel Gorman , Rik van Riel , Andrea Arcangeli Subject: [RFC 3/8] vmscan: make isolate_lru_page with filter aware Date: Wed, 27 Apr 2011 01:25:20 +0900 Message-Id: <232562452317897b5acb1445803410d74233a923.1303833417.git.minchan.kim@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2513 Lines: 70 In some __zone_reclaim case, we don't want to shrink mapped page. Nonetheless, we have isolated mapped page and re-add it into LRU's head. It's unnecessary CPU overhead and makes LRU churning. Of course, when we isolate the page, the page might be mapped but when we try to migrate the page, the page would be not mapped. So it could be migrated. But race is rare and although it happens, it's no big deal. Cc: Christoph Lameter Cc: KOSAKI Motohiro Cc: Mel Gorman Cc: Rik van Riel Cc: Andrea Arcangeli Signed-off-by: Minchan Kim --- mm/vmscan.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 71d2da9..e8d6190 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1147,7 +1147,8 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan, static unsigned long isolate_pages_global(unsigned long nr, struct list_head *dst, - unsigned long *scanned, int order, + unsigned long *scanned, + struct scan_control *sc, int mode, struct zone *z, int active, int file) { @@ -1156,8 +1157,8 @@ static unsigned long isolate_pages_global(unsigned long nr, lru += LRU_ACTIVE; if (file) lru += LRU_FILE; - return isolate_lru_pages(nr, &z->lru[lru].list, dst, scanned, order, - mode, file, 0, 0); + return isolate_lru_pages(nr, &z->lru[lru].list, dst, scanned, sc->order, + mode, file, 0, !sc->may_unmap); } /* @@ -1407,7 +1408,7 @@ shrink_inactive_list(unsigned long nr_to_scan, struct zone *zone, if (scanning_global_lru(sc)) { nr_taken = isolate_pages_global(nr_to_scan, - &page_list, &nr_scanned, sc->order, + &page_list, &nr_scanned, sc, sc->reclaim_mode & RECLAIM_MODE_LUMPYRECLAIM ? ISOLATE_BOTH : ISOLATE_INACTIVE, zone, 0, file); @@ -1531,7 +1532,7 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone, spin_lock_irq(&zone->lru_lock); if (scanning_global_lru(sc)) { nr_taken = isolate_pages_global(nr_pages, &l_hold, - &pgscanned, sc->order, + &pgscanned, sc, ISOLATE_ACTIVE, zone, 1, file); zone->pages_scanned += pgscanned; -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/