Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp328235rwo; Tue, 1 Aug 2023 18:11:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlEHRaUHlYegBx1qGap1LhsYf9wMNLwwkXFAoSf7CqZWP1ckEen1ARQV3XFf3+1sl2+SPs20 X-Received: by 2002:a05:6808:1b2b:b0:3a1:cbea:3bf2 with SMTP id bx43-20020a0568081b2b00b003a1cbea3bf2mr15861122oib.11.1690938697963; Tue, 01 Aug 2023 18:11:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690938697; cv=none; d=google.com; s=arc-20160816; b=i+sThe4eaXHP6Dbq5y0Q4zSqwcCSAWIdcMy70RTDQ6GDwQLp+2F88tmjAdpxuajP4H ArjzpVEcmyfb4lwIr6kXOlC9SXhIXQka184VPQLq/tqrYxaYGKs8QPAt4gT3GCAWZ2pk wEMusppJxg5E/TvD1Rr/YcNmDCV/oqybsVVgg9FJcy3B1kDH/BYAbCvA3fMN3U0vXZYO 5QXasGILrZlKyOjVNPO353E2rOm/dv//ZQCxbHC1jWBRG3IANJuKqUJuDrLNpLKdQaJn cuU4jm/yzJEm8bV8/BAC4eguB8ZByzsaSaVVpkb+y4mfE71o+9Irw3fvl6AAXEeJI/9g i2xQ== 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=sQqMGlFvgvQ3yvXEv1c3TG8Zu+eyY93FF0SWidKY8Dg=; fh=F0WngjkdRCY/7Ywm8xfdYViEMLybP4AkpgUWgJdmerY=; b=SSR1nGGvvpWldrHIgKJ+U8s3rpO10OYu/I1RveLFWzymCLORWPCT64CssvHUWZcziJ +f4oK/fCqMJ1QmIRDEptSqr1kicRORZFiFoUxhPGBnRNkBfSMKZgEjjNMoQiRDRdMT7N c1G4uzmT4GRbvYiPZTLqnCRtdUGlO3huv7gBMRFmuBSXIl+aroKxiv1LEWs0nW8+HjAt cWDC+noVYonoo/wFzNjQbl23nHy+VxvTlrAEaWdLRgXvWAiaGm5YfOAK/IZzSRXops6S QEeOteBIop5WccE8/F+Xl+RZCf/POdE5N9rr1VCLUnc3iYXkg1M4Ud3etwsgjHglTZza bNXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b="sjS9Sd/9"; 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 gb4-20020a17090b060400b0026301f58ac4si244313pjb.82.2023.08.01.18.11.26; Tue, 01 Aug 2023 18:11:37 -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="sjS9Sd/9"; 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 S231220AbjHBAUQ (ORCPT + 99 others); Tue, 1 Aug 2023 20:20:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231287AbjHBAUN (ORCPT ); Tue, 1 Aug 2023 20:20:13 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACC922710 for ; Tue, 1 Aug 2023 17:20:04 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-d326cb4c97fso2589861276.0 for ; Tue, 01 Aug 2023 17:20:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690935604; x=1691540404; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=sQqMGlFvgvQ3yvXEv1c3TG8Zu+eyY93FF0SWidKY8Dg=; b=sjS9Sd/96ChnfQYaR1cO5sk2N9oknVX/qJB2yXG052CqPpTjyq29z2og4PvyAUfuFb BbtTttNXygAAyEGj4VDc+gc5Tv/jJm9VVufAhbVnxD9d2fZv9SEDE3pJ6CmBfTmsJ7/M 30pcgTpZEa5b5WZTWX8yFJI4winvc57m0RSu8uswlhLrD88MgHDJlMnwkJUHOUbaDiEX XFB8o/mR1Hsb5CgE+Zf1jutf81sOk0xLQ2PlXcTmJRipNCPc6eQScIC9DvSTQlXma76v y6rPEG/+3EoY9yWeyWMpqj6nc4br7aYthBDJY27Nv4jLmE5k9Zm7VQi5fBGYNijEtZwE qVdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690935604; x=1691540404; 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=sQqMGlFvgvQ3yvXEv1c3TG8Zu+eyY93FF0SWidKY8Dg=; b=iyVvg4Dx+cspydffc7xhXdqD/MOkOorrVazUZ27irMG8OAKqmkFx67qU5Bknd95GEg ms56ZeT+8venJrlhcH9moa6TjWCS25+M7hmlpdsGDEtfVio0Zw4EL10VAZ0HD3rASpIH X2Pl8WGMywqGQkyRkEz1cFcxaOPziT3vaoQLMpvZ7h+vq4Xnwy1Y1IHSiB5ygedgNStu 6HqT+rk2o+D0KyRHNpAlpjTgwIegGwtPbkJBZPbaPZKGjRcCG0o3pLEIE776ElBnzgB5 5NSlpiA9K0cUh6z2NCK7MsOTMtXv9n14ntTG5g4Jlowudg+q+7weHHREoHLNR6nRi8tE MnFA== X-Gm-Message-State: ABy/qLYP/56jXEP5vlICzwrQZI8kWtca3jXm0OtOlMmgzhbfsbhU/mWp G5INhQy4HfYqOCawPvDPqGyRVcLefd6SAsKvOg== X-Received: from kalesh.mtv.corp.google.com ([2620:15c:211:201:aa5f:ff75:318:255]) (user=kaleshsingh job=sendgmr) by 2002:a25:48a:0:b0:d37:353:b7eb with SMTP id 132-20020a25048a000000b00d370353b7ebmr33827ybe.11.1690935603866; Tue, 01 Aug 2023 17:20:03 -0700 (PDT) Date: Tue, 1 Aug 2023 17:19:37 -0700 In-Reply-To: <20230802001938.3913174-1-kaleshsingh@google.com> Mime-Version: 1.0 References: <20230802001938.3913174-1-kaleshsingh@google.com> X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog Message-ID: <20230802001938.3913174-3-kaleshsingh@google.com> Subject: [PATCH 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 , 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_BLOCKED,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). Cc: Yu Zhao Cc: Andrew Morton Signed-off-by: Kalesh Singh --- 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