Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1288910ybg; Wed, 23 Oct 2019 13:21:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqykMDBtF4Fxygb1v/NN588rwJKR5F2+phtbM9RuvCGrmHoa4ETgJcwcCn8NbyKZK0vcOPUY X-Received: by 2002:aa7:cf81:: with SMTP id z1mr38884755edx.207.1571862084690; Wed, 23 Oct 2019 13:21:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571862084; cv=none; d=google.com; s=arc-20160816; b=GYM5QiGl+ZENU50K1dT07/EshsTkbuAn+m14zgRYi/Xr3O/Xg992A1GNHm5vIEDnOn J8e+Ndep5Cq2KORKC7ZFjnDLFCjhnMBheDt107K8dKjHt64hDSesajaDGENkM8MgpAwX niGBXzEcmechlJN0FTWsEPZw3FgiSyz39GKLQjaJHTO9AHSB4AcB5SAvjYWwtORfNynB m8aFZKhcc+4SenwspcQ08Vh8jOMOY2Q4KV24LniU0upuS4rPGut3wPqXHkuxUlCmzS3B ePId3HNiHxjfT2DP9HryWeyvOSOU9tIOVCPk6so7sYi+pwMZVw26knB1Uz/cAlNV1w2l 4/VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=MmsJnBxWf4hQ0LDsz/U/Upxlh1PUQs6UBFSzkZS1o54=; b=XtaN/Bfzevq1Wh50ZLWvHH4r2zjk4b3rZsrwNv8QCtlqMAkIw/1L3ZdvGKbanHTGq0 rwdnVjMv9tmAq7PUMjDoC7pafFcXLVSi2xfXsk2XWa24WO+xTSeRSctGFYfpLuYlxtzY 0Ttx+qNLd308Z8NU7Lm4/v6yt8aCXqt8t7V8pYl91TTKrDa5tc1F//eC7VthQX8hRr6A N/hPiG3z8NzUoQQR2ITbWNn/QRp/HyOYbDTiS7gAuFj56FT2fO7MgIrOKxrw3AStcJIH iWAq8BO6vss0f9z8QFOuAb4v16iess1pFN/ZpMId5RJT+xpY6HH3pJsuqadhKi8991Q/ NPEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h22si4569340edb.346.2019.10.23.13.21.00; Wed, 23 Oct 2019 13:21:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390461AbfJWOGq (ORCPT + 99 others); Wed, 23 Oct 2019 10:06:46 -0400 Received: from mx2.suse.de ([195.135.220.15]:49678 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390333AbfJWOGp (ORCPT ); Wed, 23 Oct 2019 10:06:45 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id EEFC7AE04; Wed, 23 Oct 2019 14:06:43 +0000 (UTC) Date: Wed, 23 Oct 2019 16:06:42 +0200 From: Michal Hocko To: Johannes Weiner Cc: Andrew Morton , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH 3/8] mm: vmscan: move inactive_list_is_low() swap check to the caller Message-ID: <20191023140642.GD17610@dhcp22.suse.cz> References: <20191022144803.302233-1-hannes@cmpxchg.org> <20191022144803.302233-4-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191022144803.302233-4-hannes@cmpxchg.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 22-10-19 10:47:58, Johannes Weiner wrote: > inactive_list_is_low() should be about one thing: checking the ratio > between inactive and active list. Kitchensink checks like the one for > swap space makes the function hard to use and modify its > callsites. Luckly, most callers already have an understanding of the > swap situation, so it's easy to clean up. > > get_scan_count() has its own, memcg-aware swap check, and doesn't even > get to the inactive_list_is_low() check on the anon list when there is > no swap space available. > > shrink_list() is called on the results of get_scan_count(), so that > check is redundant too. > > age_active_anon() has its own totalswap_pages check right before it > checks the list proportions. > > The shrink_node_memcg() site is the only one that doesn't do its own > swap check. Add it there. > > Then delete the swap check from inactive_list_is_low(). > > Signed-off-by: Johannes Weiner OK, makes sense to me. Acked-by: Michal Hocko > --- > mm/vmscan.c | 9 +-------- > 1 file changed, 1 insertion(+), 8 deletions(-) > > diff --git a/mm/vmscan.c b/mm/vmscan.c > index be3c22c274c1..622b77488144 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -2226,13 +2226,6 @@ static bool inactive_list_is_low(struct lruvec *lruvec, bool file, > unsigned long refaults; > unsigned long gb; > > - /* > - * If we don't have swap space, anonymous page deactivation > - * is pointless. > - */ > - if (!file && !total_swap_pages) > - return false; > - > inactive = lruvec_lru_size(lruvec, inactive_lru, sc->reclaim_idx); > active = lruvec_lru_size(lruvec, active_lru, sc->reclaim_idx); > > @@ -2653,7 +2646,7 @@ static void shrink_node_memcg(struct pglist_data *pgdat, struct mem_cgroup *memc > * Even if we did not try to evict anon pages at all, we want to > * rebalance the anon lru active/inactive ratio. > */ > - if (inactive_list_is_low(lruvec, false, sc, true)) > + if (total_swap_pages && inactive_list_is_low(lruvec, false, sc, true)) > shrink_active_list(SWAP_CLUSTER_MAX, lruvec, > sc, LRU_ACTIVE_ANON); > } > -- > 2.23.0 -- Michal Hocko SUSE Labs