From patchwork Wed Aug 2 00:19:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalesh Singh X-Patchwork-Id: 13337414 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 611EEC00528 for ; Wed, 2 Aug 2023 00:20:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D954028010A; Tue, 1 Aug 2023 20:20:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D44832800C8; Tue, 1 Aug 2023 20:20:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C0C7A28010A; Tue, 1 Aug 2023 20:20:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id B37D52800C8 for ; Tue, 1 Aug 2023 20:20:06 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 737DC803F6 for ; Wed, 2 Aug 2023 00:20:06 +0000 (UTC) X-FDA: 81077257212.16.4004E9C Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf17.hostedemail.com (Postfix) with ESMTP id ABBF74000B for ; Wed, 2 Aug 2023 00:20:04 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b="sjS9Sd/9"; spf=pass (imf17.hostedemail.com: domain of 3M6HJZAsKCMgyozs6v6w1uvu22uzs.q20zw18B-00y9oqy.25u@flex--kaleshsingh.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3M6HJZAsKCMgyozs6v6w1uvu22uzs.q20zw18B-00y9oqy.25u@flex--kaleshsingh.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690935604; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=sQqMGlFvgvQ3yvXEv1c3TG8Zu+eyY93FF0SWidKY8Dg=; b=R8JukKtojoiM7esi3HzEeBcfB9ICnYgktEM1ULPheb7sdsY1ZG0AK5KOPCLcgGW3lHNLaq S+y1AylJ55/tCoi4OxVMPLW9iMt572bdAlJLbFdKA/OJk+uf7eXwTvhZ4nP78CXeisHB5D t5nSSTtZD8EqtaHFFw/dOKUM5TXDV0o= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b="sjS9Sd/9"; spf=pass (imf17.hostedemail.com: domain of 3M6HJZAsKCMgyozs6v6w1uvu22uzs.q20zw18B-00y9oqy.25u@flex--kaleshsingh.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3M6HJZAsKCMgyozs6v6w1uvu22uzs.q20zw18B-00y9oqy.25u@flex--kaleshsingh.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690935604; a=rsa-sha256; cv=none; b=PxUgXmQvYIxGqQ3nDVie4jfSaNHoQMzK39J5cNIW1NrivNG2BVBY2bCZvkmxn2LD34THcX dGpKbNc6MXXzDfzAdChzo8y/4Nk50Ecf64yLp8a6BZd/EXFnB0IuG+e+oDusD7ZiMN1u41 ceLCnTlaD2uI1pvuX9kB3rLlOQN1muU= Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-d052f58b7deso6401737276.2 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=aueWoIsTe7b0T8jCvFJ/6+jsyEQKDpgHwc/nO46zf98q/yADeVSTPNT5FtWCuz69xz PbwLRifrnYtlW4SDDeFZV6xdLvpZTPNiS0VFP7dDCpYLdVMFmzkYh5WxjNE/eiAv+KCs wuF9L5/fXC20nQyUNPF51cQwTUYqXlEACp+oLCDBiarxqInQlKMmNec3z7rs+B8UK9qB a0KNsJvVb0ID+2n0peeCx1gtpaejM8hAXlRGxocUqO6jPhTzA7SZBNykvLd6Bo+NFD4X KJ0yBf59xO4WaF6dJc++h98MksillmuDijTGVP1uRA4CVM43z2XVr/t5/tAMuUHHoNiY vGgg== X-Gm-Message-State: ABy/qLajam35CNzvjsLgQVOz6B4ftvmc5JiSi3fRZFOcIe9n5sUHV2kT jCHofWaXiy+J5fTDA2pQLoKvHxFEFGUeDluF5Q== X-Google-Smtp-Source: APBJJlEf7/u2/Z616hvXFPIg4IjabnaZmfD7pavvMQxNa0+Yi7QX2OhFnd4BlpzLjlUWlOxu9nZ4P/MXGt70cu1ftA== 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 X-Rspamd-Queue-Id: ABBF74000B X-Rspam-User: X-Stat-Signature: r8j84sa4d5i4fyurktpq9a9utkwp5tp4 X-Rspamd-Server: rspam01 X-HE-Tag: 1690935604-811559 X-HE-Meta: U2FsdGVkX1+WHa/gr7iov9KwsM9YxV//UtnfwQyVmssuXOgJTRmGSvdcB9TszFVnGfvXdcAxfYmAOd53uW9IPqfvC/vT+qBRG/cPupY3v8m0nqY8pWSW60eO65PlY7UcV+ifi4IJRALbzNrBPp48rg8dBKfzvl6P3f+4xCVLxnwUnd432elgZFHvD8DFTCMwAHcVxk6wAWsYQtB+7BPj4vZYwsfhL1fKImJ5pPBkt1CS+Xml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x2Pfz60/xgDxsWSNEAa6BZ805zwVQi6R6QJWr3DKaA1dv0Sk7Ay23dXlP6ltTSsTCwOpmVC8vVlcezBgW40CiZni5B2MbUruiZcdPHWj4YERnDcTry6rIEcdEOB2vrfk8xuoh8fGZ8hg+y+jR8DF0YS9NA+CESKwfFWM8xc5eTxWcjZocuLqdIleUjeWl8qz+4Uiu0g+oigT/3Ly2CJhj2bHt7r/ptjQkyowB2cKorYYlxoYNlO+hEyENimEz9XKEqWFzCx5EqGFFLhV9/s6ghBnE3zajF+UcUpeKoi8drYYyTpKpWu+346IWcbtZGt2Cb7jlz1M0MF08m+0Nf+yCiFZXVOwQ+QuPj7Pzj9Sl2z3nvk5hxWcD623KmuQ+qj/YYj8y/ulwNdk79GAz6Em1umzp7xTqEuWVeoOeCfj5pzUcA2D9Fw7tuQrL+RXVTqLigmJF8e/tUqTAJQY+BX0TSabucdgKLz2w== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000079, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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;