From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753050AbbCKSad (ORCPT ); Wed, 11 Mar 2015 14:30:33 -0400 Received: from forward-corp1m.cmail.yandex.net ([5.255.216.100]:49784 "EHLO forward-corp1m.cmail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751524AbbCKSaa (ORCPT ); Wed, 11 Mar 2015 14:30:30 -0400 Authentication-Results: smtpcorp1m.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Subject: [PATCH RFC] mm: reset pages_scanned only when free pages are above high watermark From: Konstantin Khlebnikov To: linux-mm@kvack.org Cc: Roman Gushchin , Andrew Morton , Johannes Weiner , linux-kernel@vger.kernel.org, Mel Gorman Date: Wed, 11 Mar 2015 21:30:23 +0300 Message-ID: <20150311183023.4476.40069.stgit@buzz> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Technically, this counter works as OOM-countdown. Let's reset it only when zone is completely recovered and ready to handle any allocations. Otherwise system could never recover and stuck in livelock. Signed-off-by: Konstantin Khlebnikov --- mm/page_alloc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index ffd5ad2a6e10..ef7795c8c121 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -701,7 +701,8 @@ static void free_pcppages_bulk(struct zone *zone, int count, spin_lock(&zone->lock); nr_scanned = zone_page_state(zone, NR_PAGES_SCANNED); - if (nr_scanned) + if (nr_scanned && + zone_page_state(zone, NR_FREE_PAGES) > high_wmark_pages(zone)) __mod_zone_page_state(zone, NR_PAGES_SCANNED, -nr_scanned); while (to_free) { @@ -752,7 +753,8 @@ static void free_one_page(struct zone *zone, unsigned long nr_scanned; spin_lock(&zone->lock); nr_scanned = zone_page_state(zone, NR_PAGES_SCANNED); - if (nr_scanned) + if (nr_scanned && + zone_page_state(zone, NR_FREE_PAGES) > high_wmark_pages(zone)) __mod_zone_page_state(zone, NR_PAGES_SCANNED, -nr_scanned); if (unlikely(has_isolate_pageblock(zone) ||