Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp417961rwo; Tue, 1 Aug 2023 20:23:03 -0700 (PDT) X-Google-Smtp-Source: APBJJlFcdlUhlAYTyFH9SsH5hF8Vn+KKGfB8IadNJdhpba5cMvUq/a/mdrySGNtTy8ohP1VKQ39z X-Received: by 2002:aca:1b08:0:b0:3a3:76c6:a46f with SMTP id b8-20020aca1b08000000b003a376c6a46fmr14941252oib.38.1690946583094; Tue, 01 Aug 2023 20:23:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690946583; cv=none; d=google.com; s=arc-20160816; b=aK975PaSRAagDWjjsdOdcw/OOM1kMnpMbkeZbaGcSqE2uIiVEsKTQ+I1ag6K+hkC4F TYmGk/VBzoFx93rWpffBKenWCIMdlkj9fA0Il1xC/0Dw1TGvCbPe1qjHGNdw+ceiT9sx +idQQwoOB+cOo+jgEduoq2Mv7c0Kkz7bd5jQCZJsjTj+oL+1pg1qZTnUslOWZnRb2TG5 LOE2VNtpFRK6/tIgXAjhhy9lH5cdwk2Q2tuWPYtUPcGmh6xtn1jLsXTQBWtThE6S0jCA k7ieEl0ajMhmS5IQZquTxT8tFygZMmjVuZRfaSJObrrSwToSdT41dEoaEggMOkex72US d5qQ== 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=/hIR85jBvXabpNDlh2e7xtBRwmCRiojtCshBAYjOX1Y=; fh=Tq79lH10VspiPbCnxgbvZzxIWJDhRBjNM+7P7NtltGs=; b=VIa64pf14U7O/2LkErFw70ZAZerChzMBaLABt5N070V25dehmYjGg7ebsSOogQY39z p/i6wTDHmSputlRkbCpDFZf0/PedzCYXx1lxElHEjLgztEDzp6HBBOpwc+GBO6+bHffG Ab4oh2Xxb1f3K1AN+McmnUZJyiBcTIWnm4R8Cn+37BaOXPACGR04WGAMwFOhi4e9Hhwp U4d4htGRW7kRruVUSpLymSKhX7sY1n6H2vzmRN55I09MiLUYZinaboh5pAdRfp4UaZ2/ vZMXobqKD9NoBkw9I+OHGdS+Otr5Z57aXRpa5/oqImPJMgHRsrzKfAljKx0QYYLBbwLK B1mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=NaC24ZAN; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dc14-20020a056a0035ce00b006669351f328si10227763pfb.388.2023.08.01.20.22.50; Tue, 01 Aug 2023 20:23:03 -0700 (PDT) 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=20221208 header.b=NaC24ZAN; 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 S229928AbjHBC4p (ORCPT + 99 others); Tue, 1 Aug 2023 22:56:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231682AbjHBC4h (ORCPT ); Tue, 1 Aug 2023 22:56:37 -0400 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 F33762D4E for ; Tue, 1 Aug 2023 19:56:24 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-583da2ac09fso74295847b3.1 for ; Tue, 01 Aug 2023 19:56:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690944984; x=1691549784; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=/hIR85jBvXabpNDlh2e7xtBRwmCRiojtCshBAYjOX1Y=; b=NaC24ZANDfp+9XAVYJ2zthvJ8rUBTQ6l5oOsseG6mfA3cvF+arl71fQG1qHAhLbqJ9 9qeh16JOmABIOlkWmOSbROyLEpFlmq9EQUA6/uFoeGgx/95B08yoDHueOaoh/i5155mY XVuhu3IiHZBf1PozmtFvavLXWlrDny3HMWCrGbcbi3wm/Avg9RqMK4JG4u4VTr67QtHd KbHI/PNLuqrNbAwO5JvECyVMzM5KsSmQk2W4uE2b/bpTqBDpICou5hRnR2Ky2iDO0WiX xNEzbL/OrqT3RifP1ne+1qALr+MKSfhXAnsSEvF0phJYNv0q7iAwZlhSP5UEXbHyOUib Cf7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690944984; x=1691549784; 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=/hIR85jBvXabpNDlh2e7xtBRwmCRiojtCshBAYjOX1Y=; b=ffnY0EsPEmpLsVG7scB3dQrAUSSIwXn13W9yTLZ/6IDfvk/6hIdOp+0igsGi25qNpb jjzGTCGPi715uKPJwE7jXTp7N8oRsRV7klzi5ulgDyMg6uu2qnAwr8wfmkjEW9E1Kbao 3SROfqmmtFLEVYtl5xzHKNvJ5t5JkVC6wrY9vKGrmCXXcH9fXEU9EoxY1gxl64LgmTXN 7MHJUHj6tQNRKeX1v7lxXQ4k4iC5qD/PScRLtet57tQevqkw8YTz4Afy08OeGLTpgdi1 7Y7WYfVMNvikLlSsH8PIiBQI+2RzX90yLmxzdp2P9YgN3FI5GBuV5PFnUd0SHJI+qwY4 qUzg== X-Gm-Message-State: ABy/qLYpWPUq5VF0hsewKhXx8myqU38IDUA2iAWcX8v61auFYR6VwxfO nbw35PW0iBhy9X9LYwI8by420pWoimbPXU/0OA== X-Received: from kalesh.mtv.corp.google.com ([2620:15c:211:201:aa5f:ff75:318:255]) (user=kaleshsingh job=sendgmr) by 2002:a81:a706:0:b0:583:4f82:b9d9 with SMTP id e6-20020a81a706000000b005834f82b9d9mr120587ywh.5.1690944984182; Tue, 01 Aug 2023 19:56:24 -0700 (PDT) Date: Tue, 1 Aug 2023 19:56:04 -0700 In-Reply-To: <20230802025606.346758-1-kaleshsingh@google.com> Mime-Version: 1.0 References: <20230802025606.346758-1-kaleshsingh@google.com> X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog Message-ID: <20230802025606.346758-3-kaleshsingh@google.com> Subject: [PATCH v2 3/3] mm-unstable: Multi-gen LRU: Fix can_swap in lru_gen_look_around() From: Kalesh Singh To: yuzhao@google.com, akpm@linux-foundation.org Cc: surenb@google.com, android-mm@google.com, kernel-team@android.com, Kalesh Singh , Matthias Brugger , AngeloGioacchino Del Regno , Suleiman Souhlal , Steven Barrett , Oleksandr Natalenko , "Jan Alexander Steffens (heftig)" , Qi Zheng , Brian Geffon , Barry Song , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Content-Type: text/plain; charset="UTF-8" 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,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=ham 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 walk->can_swap might be invalid since it's not guaranteed to be initialized for the particular lruvec. Instead deduce it from the folio type (anon/file). Fixes: 018ee47f1489 ("mm: multi-gen LRU: exploit locality in rmap") Cc: Yu Zhao Cc: Andrew Morton Signed-off-by: Kalesh Singh --- Changes in v2: - Add Fixes tag mm/vmscan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 6eecd291756c..b4329f93a682 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4656,6 +4656,7 @@ void lru_gen_look_around(struct page_vma_mapped_walk *pvmw) pte_t *pte = pvmw->pte; unsigned long addr = pvmw->address; struct folio *folio = pfn_folio(pvmw->pfn); + bool can_swap = !folio_is_file_lru(folio); struct mem_cgroup *memcg = folio_memcg(folio); struct pglist_data *pgdat = folio_pgdat(folio); struct lruvec *lruvec = mem_cgroup_lruvec(memcg, pgdat); @@ -4704,7 +4705,7 @@ void lru_gen_look_around(struct page_vma_mapped_walk *pvmw) if (!pte_young(ptent)) continue; - folio = get_pfn_folio(pfn, memcg, pgdat, !walk || walk->can_swap); + folio = get_pfn_folio(pfn, memcg, pgdat, can_swap); if (!folio) continue; -- 2.41.0.255.g8b1d071c50-goog