From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754366AbdCFQaQ (ORCPT ); Mon, 6 Mar 2017 11:30:16 -0500 Received: from gum.cmpxchg.org ([85.214.110.215]:38830 "EHLO gum.cmpxchg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754325AbdCFQaO (ORCPT ); Mon, 6 Mar 2017 11:30:14 -0500 Date: Mon, 6 Mar 2017 11:24:10 -0500 From: Johannes Weiner To: Minchan Kim Cc: Michal Hocko , Andrew Morton , Jia He , Mel Gorman , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH 1/9] mm: fix 100% CPU kswapd busyloop on unreclaimable nodes Message-ID: <20170306162410.GB2090@cmpxchg.org> References: <20170228214007.5621-1-hannes@cmpxchg.org> <20170228214007.5621-2-hannes@cmpxchg.org> <20170303012609.GA3394@bbox> <20170303075954.GA31499@dhcp22.suse.cz> <20170306013740.GA8779@bbox> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170306013740.GA8779@bbox> User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 06, 2017 at 10:37:40AM +0900, Minchan Kim wrote: > On Fri, Mar 03, 2017 at 08:59:54AM +0100, Michal Hocko wrote: > > On Fri 03-03-17 10:26:09, Minchan Kim wrote: > > > On Tue, Feb 28, 2017 at 04:39:59PM -0500, Johannes Weiner wrote: > > > > @@ -3316,6 +3325,9 @@ static int balance_pgdat(pg_data_t *pgdat, int order, int classzone_idx) > > > > sc.priority--; > > > > } while (sc.priority >= 1); > > > > > > > > + if (!sc.nr_reclaimed) > > > > + pgdat->kswapd_failures++; > > > > > > sc.nr_reclaimed is reset to zero in above big loop's beginning so most of time, > > > it pgdat->kswapd_failures is increased. That wasn't intentional; I didn't see the sc.nr_reclaimed reset. --- >>From e126db716926ff353b35f3a6205bd5853e01877b Mon Sep 17 00:00:00 2001 From: Johannes Weiner Date: Mon, 6 Mar 2017 10:53:59 -0500 Subject: [PATCH] mm: fix 100% CPU kswapd busyloop on unreclaimable nodes fix Check kswapd failure against the cumulative nr_reclaimed count, not against the count from the lowest priority iteration. Suggested-by: Minchan Kim Signed-off-by: Johannes Weiner --- mm/vmscan.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index ddcff8a11c1e..b834b2dd4e19 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3179,9 +3179,9 @@ static int balance_pgdat(pg_data_t *pgdat, int order, int classzone_idx) count_vm_event(PAGEOUTRUN); do { + unsigned long nr_reclaimed = sc.nr_reclaimed; bool raise_priority = true; - sc.nr_reclaimed = 0; sc.reclaim_idx = classzone_idx; /* @@ -3271,7 +3271,8 @@ static int balance_pgdat(pg_data_t *pgdat, int order, int classzone_idx) * Raise priority if scanning rate is too low or there was no * progress in reclaiming pages */ - if (raise_priority || !sc.nr_reclaimed) + nr_reclaimed = sc.nr_reclaimed - nr_reclaimed; + if (raise_priority || !nr_reclaimed) sc.priority--; } while (sc.priority >= 1); -- 2.11.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f71.google.com (mail-wm0-f71.google.com [74.125.82.71]) by kanga.kvack.org (Postfix) with ESMTP id B60D36B0391 for ; Mon, 6 Mar 2017 11:30:02 -0500 (EST) Received: by mail-wm0-f71.google.com with SMTP id n11so30613570wma.5 for ; Mon, 06 Mar 2017 08:30:02 -0800 (PST) Received: from gum.cmpxchg.org (gum.cmpxchg.org. [85.214.110.215]) by mx.google.com with ESMTPS id v124si15217629wmd.119.2017.03.06.08.30.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Mar 2017 08:30:01 -0800 (PST) Date: Mon, 6 Mar 2017 11:24:10 -0500 From: Johannes Weiner Subject: Re: [PATCH 1/9] mm: fix 100% CPU kswapd busyloop on unreclaimable nodes Message-ID: <20170306162410.GB2090@cmpxchg.org> References: <20170228214007.5621-1-hannes@cmpxchg.org> <20170228214007.5621-2-hannes@cmpxchg.org> <20170303012609.GA3394@bbox> <20170303075954.GA31499@dhcp22.suse.cz> <20170306013740.GA8779@bbox> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170306013740.GA8779@bbox> Sender: owner-linux-mm@kvack.org List-ID: To: Minchan Kim Cc: Michal Hocko , Andrew Morton , Jia He , Mel Gorman , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@fb.com On Mon, Mar 06, 2017 at 10:37:40AM +0900, Minchan Kim wrote: > On Fri, Mar 03, 2017 at 08:59:54AM +0100, Michal Hocko wrote: > > On Fri 03-03-17 10:26:09, Minchan Kim wrote: > > > On Tue, Feb 28, 2017 at 04:39:59PM -0500, Johannes Weiner wrote: > > > > @@ -3316,6 +3325,9 @@ static int balance_pgdat(pg_data_t *pgdat, int order, int classzone_idx) > > > > sc.priority--; > > > > } while (sc.priority >= 1); > > > > > > > > + if (!sc.nr_reclaimed) > > > > + pgdat->kswapd_failures++; > > > > > > sc.nr_reclaimed is reset to zero in above big loop's beginning so most of time, > > > it pgdat->kswapd_failures is increased. That wasn't intentional; I didn't see the sc.nr_reclaimed reset. ---