Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp5747582ybg; Tue, 22 Oct 2019 07:49:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqbRr6dv+pJ+dKdW43Fw4eZ8GNDVQY3ShoIIMomaUV+0gMk+pQlgbzrJBIfOTPCmAZOC30 X-Received: by 2002:a17:906:3b4e:: with SMTP id h14mr8682104ejf.111.1571755758956; Tue, 22 Oct 2019 07:49:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571755758; cv=none; d=google.com; s=arc-20160816; b=cZKNSA/feNCHnW57iB4bSaWk2UpDyxHMGQ/MikmSyJjiEMIj3jMWjwkynNdc5QLj4o B14hfBwp1fjzupKYMlkQdd0MTNmry1oZvPZMWav7DrdO/8SLBQkDJ/H4an/9lp8dLWl5 +LLOscNlauxNmOitQtZRQbI4NoO/B2IUtTIHbIbn3BmDEP7S6veaz3v7a4PPowXwO+sR tHgbx1p7YTiRTyaeQf6I94254OWVszrZsWFA746CQz4uPIM1+V63HNnERitGsYJSbHFh xmCGDdMtgewUqEkllfl4m/TzNXt70L9yyALqAZx/h8mx8rUA0WHpkB7Gf5UOmfhRXcUm Lm9w== 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=q6d0e71c1U6ZW8RKPMSK80x36zGerojsdp9LXPgfjJI=; b=pXz9747C3nJ6pA8yqTryRw2GDBKP0rR9dztIjVnREXBuw1CoMN3eK8f9QxQ738KcsQ 2oJgnolFzIVV7gYKR+COtWIMZvxOnOhXhTsr+2zvd1pX2l2y63uK/hSQT48g7MGH5yRY mD2Ey6zff/NR8cAGHc17Hc3JYJBGaBC863DsdfVlGECfzGPJ68nKUEWUYtr4ald6v6ln WId2vKw90KWC6oIH+lgeYYs5AQeur2Qx58bci68euDfidD17tObc0F52hC065kVjcTom v6BAfAZJaK7nDfnxnVEa0LkW+kUl2KzsO5GP8A1GeX6Urwv33B5p7tG8Gw1lwU7moezT KT7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=mxq29U7K; 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 f2si1255647eda.339.2019.10.22.07.48.54; Tue, 22 Oct 2019 07:49:18 -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=mxq29U7K; 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 S2388205AbfJVOsT (ORCPT + 99 others); Tue, 22 Oct 2019 10:48:19 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:46535 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730076AbfJVOsS (ORCPT ); Tue, 22 Oct 2019 10:48:18 -0400 Received: by mail-qt1-f194.google.com with SMTP id u22so27093511qtq.13 for ; Tue, 22 Oct 2019 07:48:18 -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=q6d0e71c1U6ZW8RKPMSK80x36zGerojsdp9LXPgfjJI=; b=mxq29U7KFf8nIL2EPYKGYZG3PSPLfnfyyUP3N9kMMBJep9Noe7BqgaM7RFDkI//avH +lWfp9sEakhlXGJS7YoZspH/bCa783BlFJaZLulfx06SkaVO6nseVrPLlE02uM46F5BT aXX+S5xo0gm2UsAhO2A+VmjIUQsL1r/v4PvaaiE2y1ld5cy0y2xidgDz/jYugGswM5YV XXV8qKlJgxAtFWHtk1MlF7jqqYsu3cW2zhBUYJ9MJyMxm8kVj4CL23AeGxB9bcLq1Cws cSqoKgFqCMpFHjtqd2m7RkiZsKaft0d6fZFpH0OP4v5ikJ/CxQXmt9q7gy7W0QOWLeLy G68g== 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=q6d0e71c1U6ZW8RKPMSK80x36zGerojsdp9LXPgfjJI=; b=Yt4rUay80/tiHEtsYODqtgU1eHtyqH9cqgfiNyyFfODrUjzUtAvlxdlGTl5H/iCNEM VmOnk5MEY0HEdocz9wtF68amngNBEAps8S9Bmyj3vgb9zWVm16I28EwtZnrzZpoYPQWS oljRsyukxiiyayUL8yUhAu+Qky+NBR1XQrA5u/fRz1OKIp/aHkwnU0lOUEVBjcS4m0G+ C+nkfr3zp/8X9J02Dx6wnvoiL9Wu3QRi20h01L1GXKpg+Hb/hpMskAFne+AKYKLLk99m jUtlXx5HCh5+TsqH0ZjN/TLUXqvVjfLh/IyPGaN37tkfTNhTKVtd/ojZ/+60ZhiM3aSo 29RQ== X-Gm-Message-State: APjAAAV/xNUoDs7/dbvLbzObLy4IT/VRUFBv1SU2LxkjISj3px0tyZ5G Cd/VWCug+UrRJWi+PZFqLNv/GQ== X-Received: by 2002:ac8:6146:: with SMTP id d6mr3741857qtm.271.1571755697749; Tue, 22 Oct 2019 07:48:17 -0700 (PDT) Received: from localhost ([2620:10d:c091:500::3:10ad]) by smtp.gmail.com with ESMTPSA id p4sm10518531qkf.112.2019.10.22.07.48.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 07:48:17 -0700 (PDT) From: Johannes Weiner To: Andrew Morton Cc: Michal Hocko , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [PATCH 3/8] mm: vmscan: move inactive_list_is_low() swap check to the caller Date: Tue, 22 Oct 2019 10:47:58 -0400 Message-Id: <20191022144803.302233-4-hannes@cmpxchg.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191022144803.302233-1-hannes@cmpxchg.org> References: <20191022144803.302233-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 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