From patchwork Tue Nov 22 20:38:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mina Almasry X-Patchwork-Id: 24554 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2428706wrr; Tue, 22 Nov 2022 12:40:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf6M04hBlpnxxbEp4vd6Hmns81OfWfcsXB3h/CJhW5TApVTUjIukauX3AuixdBjv6DMzf5Wl X-Received: by 2002:a63:b16:0:b0:46e:c052:a6b0 with SMTP id 22-20020a630b16000000b0046ec052a6b0mr4781243pgl.91.1669149653056; Tue, 22 Nov 2022 12:40:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669149653; cv=none; d=google.com; s=arc-20160816; b=zPp9sxq9Uklm1ao/IpjVGAq2gGBr1ZuEfoUI/e11isG+InVMvbXdwiu6HOwjErr8WA YNLDzqd6KT4IWB9RTwr8IfALdZwS5kUNrIx2BQmRxjFWJo4fX83gfBYFDAlWkBdPUPLw bdX5n9u3EQrqnN4LSLJ3B166EDk2S3/Bs8kkBGhTICrJ0zKTYHhzt4sDpCDpwXZzmZkZ kPyXWWy+vtLHcpBcfaM54qk8mTKgvZ5O+B17y2qz8ws94+c5b58zlyJZEC0d8bnqNMQO r8gWvWVlNRT3ErFGDKmV/XthsQCqnpk65Fb9Z1HgRU0DcjSmWh2+t9hJ/7HyWB8yN46l gr9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=FPSzCF4B4ZUUfFv+NywISnCJ1Cav2tvMYf25Hqqvvgg=; b=b8AOccZFkrNkqkvPCs6RoZkPSQLGDnxFeM2DpEaZXPCom2pdSvfRzOcMymjBfwMixQ RQNLw/bKcT5AtEwAzUezAUiAP9MSAkd+etBtAGnMyaTR08KAN80IxUZmHy0Nn2pi3Ulq 1VLwNu2pBYGpn41PFeN+3Bj2kiXdgbTHmwQaVehCUBMB/PQ7Qi8lCs11SOXL9abhjjCd 9QYTKGkEgeOs0Ex0R6Cqez4+uCfiKs+5bZCQvbi+xJHHscn31s9tloYmqivq3wKIFGlc FhNvdXmmRqhQ1Y1M7Zb23Usao9OiLXRtzTeerY5pi6wGaLUtJgfpbACGujxUoo9xSX3G ktdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="Ylw0t/TQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v13-20020a63464d000000b004774c91418dsi9925480pgk.523.2022.11.22.12.40.38; Tue, 22 Nov 2022 12:40:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="Ylw0t/TQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234899AbiKVUjW (ORCPT + 99 others); Tue, 22 Nov 2022 15:39:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234777AbiKVUjN (ORCPT ); Tue, 22 Nov 2022 15:39:13 -0500 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5AF868C75 for ; Tue, 22 Nov 2022 12:39:11 -0800 (PST) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-393c38f7bcfso128045147b3.5 for ; Tue, 22 Nov 2022 12:39:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=FPSzCF4B4ZUUfFv+NywISnCJ1Cav2tvMYf25Hqqvvgg=; b=Ylw0t/TQAkkJ5ZZ1Pjx3hAcFXh/aS80QxJujdVf6jQSIZZqenDDpuUnVzgNX6ILpOT D+OjVdmtDW5/tAPK26Gb1zGy/ZoTCNYUJRF0pyT+nwSM+/hfu38zrqKsPnMqXGmEd+xx cuUwYrnWdEWlYYI+NWRholXeyBpeozHwyScvQAjTUOFxdVVobSIfg3zrrhjVGUP9l7Px HcnmajR3YLpKxiUY3qDInKNDQjuM2qZP0Bd8vfd5A7IwOfoP5RK2bZZ11acFXKOU83kT GwdUHROVxNzf/nQ9nlj5eX8S+GZeK8I5hMFTQ/pyIzMVhZn83FC27sX4jgh9Me5r10Ge mRkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FPSzCF4B4ZUUfFv+NywISnCJ1Cav2tvMYf25Hqqvvgg=; b=hSg9oDOuTDIY7qYkqZIMmukoYNlf5GISiD+Eo0Ml7qK6I4frZ+gk3dB5UWFRXqFhS2 wLVT8pl+UZEaHlELig428vlV/h7/+I57VR5FMA5ZI8Gl0r4X2paNT/Thj9NCDWjTYfkz MFnRfxPMW5Ljzo3VsSZTd3M9qBd+rCXW1kvn0ZmveulmR+DrkoFyQkvt/MUrZbxULF/k V9TRny6uySrE9/yIDcppPpTTvxlgrLl92nwbbyDod163xOVrK75bPJih4nK6Su1T+8/d z2rcKfXmkwnz99TFpM8sr2CLX5FNPKI7pEA47Rkf9V/hSai3OW6+AnFXEqMxxUgBTQBH FUmA== X-Gm-Message-State: ANoB5pnMtnBKeBnTDw5t83zbimYs/3L+zf6iW5RHqONxqtylzbIExPoA TaamPS/HDvUtmBxelO2ajh91Z2O0epb1nIy52Q== X-Received: from almasrymina.svl.corp.google.com ([2620:15c:2d4:203:b7d0:497d:abe4:3e6f]) (user=almasrymina job=sendgmr) by 2002:a25:cccc:0:b0:6de:afe7:1c27 with SMTP id l195-20020a25cccc000000b006deafe71c27mr2ybf.642.1669149550378; Tue, 22 Nov 2022 12:39:10 -0800 (PST) Date: Tue, 22 Nov 2022 12:38:47 -0800 In-Reply-To: <20221122203850.2765015-1-almasrymina@google.com> Mime-Version: 1.0 References: <20221122203850.2765015-1-almasrymina@google.com> X-Mailer: git-send-email 2.38.1.584.g0f3c55d4c2-goog Message-ID: <20221122203850.2765015-3-almasrymina@google.com> Subject: [RFC PATCH v1 3/4] mm: Fix demotion-only scanning anon pages From: Mina Almasry To: Huang Ying , Yang Shi , Yosry Ahmed , Tim Chen , weixugc@google.com, shakeelb@google.com, gthelen@google.com, fvdl@google.com, Andrew Morton Cc: Mina Almasry , Muchun Song , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750230266855953067?= X-GMAIL-MSGID: =?utf-8?q?1750230266855953067?= This is likely a missed change from commit a2a36488a61c ("mm/vmscan: Consider anonymous pages without swap"). Current logic is if !may_swap _or_ !can_reclaim_anon_pages() then we don't scan anon memory. This should be an 'and'. We would like to scan anon memory if we may swap or if we can_reclaim_anon_pages(). Fixes: commit a2a36488a61c ("mm/vmscan: Consider anonymous pages without swap") Signed-off-by: Mina Almasry --- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.38.1.584.g0f3c55d4c2-goog diff --git a/mm/vmscan.c b/mm/vmscan.c index 8c1f5416d789..d7e509b3f07f 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2931,7 +2931,7 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, enum lru_list lru; /* If we have no swap space, do not bother scanning anon folios. */ - if (!sc->may_swap || !can_reclaim_anon_pages(memcg, pgdat->node_id, sc)) { + if (!sc->may_swap && !can_reclaim_anon_pages(memcg, pgdat->node_id, sc)) { scan_balance = SCAN_FILE; goto out; }