Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753048AbbHCKTh (ORCPT ); Mon, 3 Aug 2015 06:19:37 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:44395 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753006AbbHCKTf (ORCPT ); Mon, 3 Aug 2015 06:19:35 -0400 X-AuditID: cbfee68e-f79c56d000006efb-46-55bf4036ced1 From: Jaewon Kim To: akpm@linux-foundation.org Cc: mgorman@suse.de, minchan@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, jaewon31.kim@gmail.com, Jaewon Kim Subject: [PATCH] vmscan: reclaim_clean_pages_from_list() must count mlocked pages Date: Mon, 03 Aug 2015 19:18:27 +0900 Message-id: <1438597107-18329-1-git-send-email-jaewon31.kim@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrNLMWRmVeSWpSXmKPExsVy+t8zXV0zh/2hBg+XylnMWb+GzaJ780xG i973r5gsLu+aw2Zxb81/VovJ754xWiz7+p7dgd1j56y77B6bVnWyeWz6NInd48SM3ywefVtW MXpsPl3t8XmTXAB7FJdNSmpOZllqkb5dAlfG/4WLmQq2CFdM6pjM2sB4g7+LkYNDQsBEYvpV li5GTiBTTOLCvfVsXYxcHEICKxklLu86zQ6RMJHYtPIYO0RiKaPE2k0tzBDOd0aJDyc3soFU sQloS7xfMIkVxBYRkJWY+vc8C0gRs8AcRokFp08zgqwTFgiWWAeyjoODRUBVYvnRSpByXgEP iQUr5zBBLJOTOHlsMitIq4TAZHaJPUuOg81nERCQ+Db5EAvE1bISmw4wQ9RLShxccYNlAqPg AkaGVYyiqQXJBcVJ6UVGesWJucWleel6yfm5mxghYdy3g/HmAetDjAIcjEo8vDPm7QsVYk0s K67MPcRoCrRhIrOUaHI+MFrySuINjc2MLExNTI2NzC3NlMR5E6R+BgsJpCeWpGanphakFsUX leakFh9iZOLglGp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ass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2658 Lines: 76 reclaim_clean_pages_from_list() decreases NR_ISOLATED_FILE by returned value from shrink_page_list(). But mlocked pages in the isolated clean_pages page list would be removed from the list but not counted as nr_reclaimed. Fix this miscounting by returning the number of mlocked pages and count it. Signed-off-by: Jaewon Kim --- mm/vmscan.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 5e8eadd..5837695 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -849,6 +849,7 @@ static unsigned long shrink_page_list(struct list_head *page_list, unsigned long *ret_nr_congested, unsigned long *ret_nr_writeback, unsigned long *ret_nr_immediate, + unsigned long *ret_nr_mlocked, bool force_reclaim) { LIST_HEAD(ret_pages); @@ -1158,6 +1159,7 @@ cull_mlocked: try_to_free_swap(page); unlock_page(page); putback_lru_page(page); + (*ret_nr_mlocked)++; continue; activate_locked: @@ -1197,6 +1199,7 @@ unsigned long reclaim_clean_pages_from_list(struct zone *zone, .may_unmap = 1, }; unsigned long ret, dummy1, dummy2, dummy3, dummy4, dummy5; + unsigned long nr_mlocked = 0; struct page *page, *next; LIST_HEAD(clean_pages); @@ -1210,8 +1213,10 @@ unsigned long reclaim_clean_pages_from_list(struct zone *zone, ret = shrink_page_list(&clean_pages, zone, &sc, TTU_UNMAP|TTU_IGNORE_ACCESS, - &dummy1, &dummy2, &dummy3, &dummy4, &dummy5, true); + &dummy1, &dummy2, &dummy3, &dummy4, &dummy5, + &nr_mlocked, true); list_splice(&clean_pages, page_list); + ret += nr_mlocked; mod_zone_page_state(zone, NR_ISOLATED_FILE, -ret); return ret; } @@ -1523,6 +1528,7 @@ shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec, unsigned long nr_unqueued_dirty = 0; unsigned long nr_writeback = 0; unsigned long nr_immediate = 0; + unsigned long nr_mlocked = 0; isolate_mode_t isolate_mode = 0; int file = is_file_lru(lru); struct zone *zone = lruvec_zone(lruvec); @@ -1565,7 +1571,7 @@ shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec, nr_reclaimed = shrink_page_list(&page_list, zone, sc, TTU_UNMAP, &nr_dirty, &nr_unqueued_dirty, &nr_congested, - &nr_writeback, &nr_immediate, + &nr_writeback, &nr_immediate, &nr_mlocked, false); spin_lock_irq(&zone->lru_lock); -- 1.9.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/