From mboxrd@z Thu Jan 1 00:00:00 1970 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 29EA5D36129 for ; Wed, 6 Nov 2024 02:09:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AFFA86B0092; Tue, 5 Nov 2024 21:09:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A87A86B0096; Tue, 5 Nov 2024 21:09:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 959576B0098; Tue, 5 Nov 2024 21:09:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 7577B6B0092 for ; Tue, 5 Nov 2024 21:09:00 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 67032121958 for ; Wed, 6 Nov 2024 02:08:59 +0000 (UTC) X-FDA: 82754035518.03.D736620 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf30.hostedemail.com (Postfix) with ESMTP id F103180010 for ; Wed, 6 Nov 2024 02:07:53 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="JuPkbg9/"; spf=pass (imf30.hostedemail.com: domain of sashal@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sashal@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730858888; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=sqVOuTVmPS7VFWju/N62KpR39j27BwKtmnHIgKmPdAY=; b=240m18M+uDnMAfOguu+dFTkDke2iUlcWvWr9Cy6opNEDozHABg52Dt3QgmxrnNU/DMIhAh LOkeawevQJ/B6u50j2I4OQ7EN8yGgY/Pukg4XNCyZYaLNYzdtWuX5ZesaRguRi/fG9oCcF bYl0MgxxzRflaRp/L8gn1Xn58uTdNRs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730858888; a=rsa-sha256; cv=none; b=zk1VSmpA+4qJD72d1+Apn/SzebE8FrdqrFSzZiKznIjLJsspL0v6BG7rNWQLkZoZSxxPsq WpatN1bbHo/FsFO+15BKj2ltRVbPyjVj1uhzb10MyC6IHmwbCeeiHwMH98qb4mIKYdTfSj vXmeWn2fuAY1qX6qkxYfhtK3gtSRp7o= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="JuPkbg9/"; spf=pass (imf30.hostedemail.com: domain of sashal@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sashal@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id F3A6E5C045E; Wed, 6 Nov 2024 02:08:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75168C4CED2; Wed, 6 Nov 2024 02:08:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730858936; bh=KIe/KEW91IPqujU0BncaTPY0p4kDvJKl4ECvQ4MD/BE=; h=From:To:Cc:Subject:Date:From; b=JuPkbg9/BX4XPYjQLUsandS8dV+wSbeFh2WRXNIEl1WmGP5nZHRRkkErXxqWZtlFR wMRU5phTM24MR5ct5PH5t/7qLtALRn68bt0UfCsI821KehJDZ9RrwEEV6DITTT2732 rESpzqc+FLpFXMMTr4G0k4xNI1hez3QKgOluytMJlRAHV4XKAjMm3lD6eo+qS53LzP NoGvrRjcp8JIdSSNo3QmgMq6ufespR13iZZKj6DCahdxKuURu/fyhJqabOdaRLWwtk l8UmE3o9JfnJeAqB3YePs3pSeDALoTOKsLpaEXyglg1S8ZrTVMeo+Yor90OYYRaFKJ c9BatprBdPuYQ== From: Sasha Levin To: stable@vger.kernel.org, yuzhao@google.com Cc: James Houghton , Axel Rasmussen , David Matlack , David Rientjes , David Stevens , Oliver Upton , Paolo Bonzini , Sean Christopherson , Wei Xu , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: FAILED: Patch "mm: multi-gen LRU: remove MM_LEAF_OLD and MM_NONLEAF_TOTAL stats" failed to apply to v6.6-stable tree Date: Tue, 5 Nov 2024 21:08:52 -0500 Message-ID: <20241106020852.164488-1-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Patchwork-Hint: ignore X-stable: review Content-Transfer-Encoding: 8bit X-Stat-Signature: byboapfh775hk4co1u8kc9rt8tuzujsh X-Rspam-User: X-Rspamd-Queue-Id: F103180010 X-Rspamd-Server: rspam02 X-HE-Tag: 1730858873-85607 X-HE-Meta: U2FsdGVkX18bAXibGi7tUteoargEtLzOm9kmlccYp3HHlaLaScP2FlJYUJoYyUtQ8X+oboNTuNvJCOHNrCYb2qIXbYfu4KTJ1F69LyO1e7UlqeYPtieKgvnH57q2y/3zj2J5IDL5XIFgVMW2XI+nn5/Z8Hrv0fFxDrK7qk2QfsCXjiiTyQn9Y4peaIZMqNYQacZeIbRrmzMYWyTANY5kCBt8XCgS/SNcj/Uy8fkYjiCSo6tPmONfUo0yEz0t/hDxk0ambzph+66SLwQUmxUGfnkuXZ9qUfWV4xYZqxasJV1gUAu+zewj4ZApvlfwYrwgIzLODSwGzeFXw6kxDiJ24G/zRf0eYbWLUhvH0kdIYBFVSfAg/BiwgR7KiWRLOXX8JnVENFVFRUMmfbLuh1IMWN2Rwm4SlN015uxVTv2qzl7ZdG3ynPbk/fNwkk0OVoIofwZVz7miMoJCDNTMJSnPeui7EW9pxMT27mEKx/LE8LxbP4PYnXjec402vjM1Zk7c4lgLKX8KKcNKH4N1bMXmmxQJS9mT91F9DYxuSwZvc1iDW190dVwHc1VhEbQC8fPx/AxmtR3Fu9/ZqL1Y1U/y4GrTfHn66JcMnwlkp/dXunsv0rn0XNGw4MZPUITCqzuPVZBOnP0qiXz1rbDycGKp5ZnYiF9/n/4DKYzkk2mtD3sGmfELLkAlaiCluKzZ/Sg1U9QbGh9TBIsJn/YcoaE944m/n5aU+LGkeKo8b+PsNQ3/3reAWGvKKRv0V5RkHUwty0D+UtZTf4OD/u96x3bU6v/b3Mo1laPoCMHEGh47or28DjykA2ZWp4UMrhx4Aga6PbKDEqGrmDPDcZC5mgD9ADP1NrhAPsvo8JXTdoPCtRfqcpcCu3fji1lh3f08WUUJw4ykTRgAiJKLF4F8QnfQ+flbg33qllw9TKm6xedOXxTtL6A6J23F21ZzvPaV/k/ylrVDeounZK0MAdZ+aJV 8fzZQp1S sfys/ipLQ1sJbOSd7eSeXD4cSApYLPdas+/kAaavQVgEYEtCsrT1u6skdvCm0kW+sxANNvUfU/8mTbO4cmx3hcjUO5++UCHFI4oetv0ONb8OADT0/L+0ywT1Jlr6qsCnI4CZogaM5qljW6122sUybCIoSLOKl43wdDOPOlQJxmovc5JUZxCkOJl9rqO+fc9oMqxpXQFG5Dt+uFjOKRPMSTMjgqzUAlxlAEtv3Wf4M0iWJA+ylc2q9ZFYNSveKxZR7clTCQ94pAURnE5TafkY+JIbXso0YLwgnQJAgjvIPG8ZaV375VJD12w9/W7NgU+DqNAYEZK+Bm+yujjj+JKo3EIWw/pcdpnJWK+0J2tN+wmrQ9dFqRCiznwDDYGfKqjn5Xd0qKlPrkAAyvw0= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The patch below does not apply to the v6.6-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . Thanks, Sasha ------------------ original commit in Linus's tree ------------------ >From ddd6d8e975b171ea3f63a011a75820883ff0d479 Mon Sep 17 00:00:00 2001 From: Yu Zhao Date: Sat, 19 Oct 2024 01:29:38 +0000 Subject: [PATCH] mm: multi-gen LRU: remove MM_LEAF_OLD and MM_NONLEAF_TOTAL stats Patch series "mm: multi-gen LRU: Have secondary MMUs participate in MM_WALK". Today, the MM_WALK capability causes MGLRU to clear the young bit from PMDs and PTEs during the page table walk before eviction, but MGLRU does not call the clear_young() MMU notifier in this case. By not calling this notifier, the MM walk takes less time/CPU, but it causes pages that are accessed mostly through KVM / secondary MMUs to appear younger than they should be. We do call the clear_young() notifier today, but only when attempting to evict the page, so we end up clearing young/accessed information less frequently for secondary MMUs than for mm PTEs, and therefore they appear younger and are less likely to be evicted. Therefore, memory that is *not* being accessed mostly by KVM will be evicted *more* frequently, worsening performance. ChromeOS observed a tab-open latency regression when enabling MGLRU with a setup that involved running a VM: Tab-open latency histogram (ms) Version p50 mean p95 p99 max base 1315 1198 2347 3454 10319 mglru 2559 1311 7399 12060 43758 fix 1119 926 2470 4211 6947 This series replaces the final non-selftest patchs from this series[1], which introduced a similar change (and a new MMU notifier) with KVM optimizations. I'll send a separate series (to Sean and Paolo) for the KVM optimizations. This series also makes proactive reclaim with MGLRU possible for KVM memory. I have verified that this functions correctly with the selftest from [1], but given that that test is a KVM selftest, I'll send it with the rest of the KVM optimizations later. Andrew, let me know if you'd like to take the test now anyway. [1]: https://lore.kernel.org/linux-mm/20240926013506.860253-18-jthoughton@google.com/ This patch (of 2): The removed stats, MM_LEAF_OLD and MM_NONLEAF_TOTAL, are not very helpful and become more complicated to properly compute when adding test/clear_young() notifiers in MGLRU's mm walk. Link: https://lkml.kernel.org/r/20241019012940.3656292-1-jthoughton@google.com Link: https://lkml.kernel.org/r/20241019012940.3656292-2-jthoughton@google.com Fixes: bd74fdaea146 ("mm: multi-gen LRU: support page table walks") Signed-off-by: Yu Zhao Signed-off-by: James Houghton Cc: Axel Rasmussen Cc: David Matlack Cc: David Rientjes Cc: David Stevens Cc: Oliver Upton Cc: Paolo Bonzini Cc: Sean Christopherson Cc: Wei Xu Cc: Signed-off-by: Andrew Morton --- include/linux/mmzone.h | 2 -- mm/vmscan.c | 14 +++++--------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 17506e4a28355..9342e5692dab6 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -458,9 +458,7 @@ struct lru_gen_folio { enum { MM_LEAF_TOTAL, /* total leaf entries */ - MM_LEAF_OLD, /* old leaf entries */ MM_LEAF_YOUNG, /* young leaf entries */ - MM_NONLEAF_TOTAL, /* total non-leaf entries */ MM_NONLEAF_FOUND, /* non-leaf entries found in Bloom filters */ MM_NONLEAF_ADDED, /* non-leaf entries added to Bloom filters */ NR_MM_STATS diff --git a/mm/vmscan.c b/mm/vmscan.c index eb4e8440c5071..4f1d33e4b3601 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3399,7 +3399,6 @@ static bool walk_pte_range(pmd_t *pmd, unsigned long start, unsigned long end, continue; if (!pte_young(ptent)) { - walk->mm_stats[MM_LEAF_OLD]++; continue; } @@ -3552,7 +3551,6 @@ static void walk_pmd_range(pud_t *pud, unsigned long start, unsigned long end, walk->mm_stats[MM_LEAF_TOTAL]++; if (!pmd_young(val)) { - walk->mm_stats[MM_LEAF_OLD]++; continue; } @@ -3564,8 +3562,6 @@ static void walk_pmd_range(pud_t *pud, unsigned long start, unsigned long end, continue; } - walk->mm_stats[MM_NONLEAF_TOTAL]++; - if (!walk->force_scan && should_clear_pmd_young()) { if (!pmd_young(val)) continue; @@ -5254,11 +5250,11 @@ static void lru_gen_seq_show_full(struct seq_file *m, struct lruvec *lruvec, for (tier = 0; tier < MAX_NR_TIERS; tier++) { seq_printf(m, " %10d", tier); for (type = 0; type < ANON_AND_FILE; type++) { - const char *s = " "; + const char *s = "xxx"; unsigned long n[3] = {}; if (seq == max_seq) { - s = "RT "; + s = "RTx"; n[0] = READ_ONCE(lrugen->avg_refaulted[type][tier]); n[1] = READ_ONCE(lrugen->avg_total[type][tier]); } else if (seq == min_seq[type] || NR_HIST_GENS > 1) { @@ -5280,14 +5276,14 @@ static void lru_gen_seq_show_full(struct seq_file *m, struct lruvec *lruvec, seq_puts(m, " "); for (i = 0; i < NR_MM_STATS; i++) { - const char *s = " "; + const char *s = "xxxx"; unsigned long n = 0; if (seq == max_seq && NR_HIST_GENS == 1) { - s = "LOYNFA"; + s = "TYFA"; n = READ_ONCE(mm_state->stats[hist][i]); } else if (seq != max_seq && NR_HIST_GENS > 1) { - s = "loynfa"; + s = "tyfa"; n = READ_ONCE(mm_state->stats[hist][i]); } -- 2.43.0