Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4666543ybi; Mon, 3 Jun 2019 15:08:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqxsO7SINLgZ0CyAvTYngDhtLsETjJ+TE8mTs7u3TzGzGPDZe+RcJDI8RmPnyuKq2SYvu7xd X-Received: by 2002:a17:902:683:: with SMTP id 3mr30379083plh.209.1559599709327; Mon, 03 Jun 2019 15:08:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559599709; cv=none; d=google.com; s=arc-20160816; b=wo7602L3W3U+DfFr4gxerPAn3AjEe9iQu3AcXXgztwrIbPPfNz9rWLkPdekVrGP8cx OqSk3UGztxLq6dUIHjPF66HWdzsq44j6jdl4M/zRqw+5K+06aqaLCoDUZXU6cFMWcMfk sn7ZxykiLWvcPSkfUSbL7t8Oz7djGXckudF8IEf3TChP0axPo17TDtMReCTwzHdrBM6G kGRK3Ef5WqKwUFjbSd1VVl8OZE4ZOnhFZXs/b1Q4ti7/1Z6LM++bDlP9bWn2yVqpR3Wy tXUDuT0zMGLXlPbuV2scHbJZyRqYELctYgmfwwaJuyLdEMeHeiTHDLBZxYkYi8isn9D3 uKdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0EoeyvI+6nSZVdPsXoo6A3bLjv7jCmnakg13/Vo0S7g=; b=aQHmlrVebJThiv6gb6ihQC1TEyvAV5cu4i0P6SjmOEdXx5lhf/rnhgvVA671d5M3fo 8vxUQZjhaWpERr39nPrlD2WffmEyXZpd4EU9+GmDt6YNBWOPWXyf2DUd1DtMPZEG78k4 SZXgKu8zbv4+eeR3xip50ZOQmS+geCseDuXBYdcKbIarXpO/jdcyGly9vmuidJe/oXu/ ZUJXUtjemngoL2y+8PblHPHO4Tnw7ro15TDJDzgq3WdYaKZp2z2Wk3eY0Yo4q8QCMG7k aQZkm65fA6V7ue3RiSVquTDjadmpSPLneRYZcCxdZroXKndwZn3QWhI3JjyDVZdDPcTc HzgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=jQQKpymP; 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=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b2si16172613pls.93.2019.06.03.15.08.13; Mon, 03 Jun 2019 15:08:29 -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; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=jQQKpymP; 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=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726686AbfFCWHI (ORCPT + 99 others); Mon, 3 Jun 2019 18:07:08 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:38900 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726336AbfFCWHH (ORCPT ); Mon, 3 Jun 2019 18:07:07 -0400 Received: by mail-pf1-f194.google.com with SMTP id a186so10680522pfa.5 for ; Mon, 03 Jun 2019 15:07:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0EoeyvI+6nSZVdPsXoo6A3bLjv7jCmnakg13/Vo0S7g=; b=jQQKpymP0x+HXM6AidEDpl+oryXhrFlsULaSJxrk+bRuLIK2zph32NK7fQ9YAJaCBe N7+enaR2Vc1oYLo8aptLEfjl+dIsZ+yBuVWMXGIzNgNQI9SdCmD/jLhITwBQ9ehLSkb+ XEVP/h3PMZVC5vzDLRMA2ctacgD5ioiLhXBcIfjUB5IUWXVcT3hHScDrk9eh/9mNvu5o PWXDbM+Um+WQ9hcOjSXq+jo3FDIH6cYOI+MipuzXRWJvoaNI+qxII2acSgoctNl9nHHf 375AuTgxJjHK4jIuhHyjGLr4uaIo2/oQ034Ox+mp98rzfJnHVOkExpOIKkw9vVPM1s+r yyag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0EoeyvI+6nSZVdPsXoo6A3bLjv7jCmnakg13/Vo0S7g=; b=fXEH/S5EbEJL2b6lp3NmmufeVU6mikGZOMeGjzPg1TvCeZm09XcIp6Hnghk2wqlAim +JpdWOsLt42RK/VlQ2jF6/Q9a76SSxfcoDjzu88EHJgMTj8mhjHkRSYPSZ9hcUD5do4o wY7v/4Wx+YBH8bkkhHXo7vH6WsK/jrNXvTcesBDADyoGJe0/I0H2gY6hxQGwhlrl4FrV 4HT3wb2xqIcgPCgIzkzbnhPep8scFG9YVJQSquBkQgnRJEWxK89XG0VzSfAOpcEB0X9g uxRx8xqQXpiLou9uWRgGLZwEMfFiUqUp1DSAKk9n690VZNG5DQGp+0c9u3nrK09EuSpU t4qQ== X-Gm-Message-State: APjAAAXpzE04zkA3KawjIc8zdF/5R2X6UptQuZOY6z1sPrbx2jVI+mwH QCGez4XYMh7MXDWq6YYwa5jDxw== X-Received: by 2002:a63:a34c:: with SMTP id v12mr30337699pgn.198.1559596104078; Mon, 03 Jun 2019 14:08:24 -0700 (PDT) Received: from localhost ([2620:10d:c091:500::1:9fa4]) by smtp.gmail.com with ESMTPSA id n32sm7753279pji.29.2019.06.03.14.08.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Jun 2019 14:08:23 -0700 (PDT) From: Johannes Weiner To: Andrew Morton Cc: Andrey Ryabinin , Suren Baghdasaryan , Michal Hocko , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [PATCH 01/11] mm: vmscan: move inactive_list_is_low() swap check to the caller Date: Mon, 3 Jun 2019 17:07:36 -0400 Message-Id: <20190603210746.15800-2-hannes@cmpxchg.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190603210746.15800-1-hannes@cmpxchg.org> References: <20190603210746.15800-1-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- mm/vmscan.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 84dcb651d05c..f396424850aa 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2165,13 +2165,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); @@ -2592,7 +2585,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.21.0