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 36DD6C3DA41 for ; Wed, 10 Jul 2024 17:59:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BED9F6B0089; Wed, 10 Jul 2024 13:59:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B4F2E6B0092; Wed, 10 Jul 2024 13:59:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9C8BD6B0096; Wed, 10 Jul 2024 13:59:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 7BA0F6B0089 for ; Wed, 10 Jul 2024 13:59:54 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 2C4FFA15E1 for ; Wed, 10 Jul 2024 17:59:54 +0000 (UTC) X-FDA: 82324606308.21.5E9547B Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) by imf09.hostedemail.com (Postfix) with ESMTP id 5736F140034 for ; Wed, 10 Jul 2024 17:59:52 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=asRx2iG8; spf=pass (imf09.hostedemail.com: domain of yuzhao@google.com designates 209.85.160.182 as permitted sender) smtp.mailfrom=yuzhao@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=1720634377; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=aF3CnZV7DMRprpGI4b2ruu391JiaLKZraUtA5FT1zY0=; b=1WZzvOXQv9jqNAXZ/mFFEDCUMt3kSQL76oy5zPfmc5WUIZe+RzpeYJKUO/SifM05dscn28 KHRNK/sHIVC4B8lY5OfazjL7bsuvToMjCTY1gwgmjt1U6yAUmcMMan1T67QxWTeIxGYz5l O7dljxpTDShgLNQdMtKGaxCglYYi1iA= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=asRx2iG8; spf=pass (imf09.hostedemail.com: domain of yuzhao@google.com designates 209.85.160.182 as permitted sender) smtp.mailfrom=yuzhao@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720634377; a=rsa-sha256; cv=none; b=5H4VDyeWRRp1elgP49ipAZumWL/QjsKEM2BUw4/D78gugtZO8BCZBVDAW9s1f3nX0oaGxH L1L/CxT/WfPmI3D3HVEoA1hRgxnDPjmGF3UR4Ti8dwNzPm61o5MUtc8AegNWIV9EN9/DJi Ox/ZbDwsKOKnAfxoEsIZmvnbQ8h8Rjg= Received: by mail-qt1-f182.google.com with SMTP id d75a77b69052e-447df43324fso25171cf.1 for ; Wed, 10 Jul 2024 10:59:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1720634391; x=1721239191; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=aF3CnZV7DMRprpGI4b2ruu391JiaLKZraUtA5FT1zY0=; b=asRx2iG834+0Z2QX1TLZj/gQaoMkVEqD5cPOrBA1skgO/dVpOSEUyPcTPoV5PkxQ5F vO2Hq+y8TM9ATAYxW0wUgX7oKNHtmHYvaJT2hUeVi2lBUzaEKLSffngh0vqtWLtTvvxB TZe3z570GS5tNz7A5W7rh5HtTAEXK2UGadFdMnZKc+QdOBwc2apcbfd+a7ejHb3Y2NI3 z+/P4t6rrqq7bckkO4uAttR6XmQYtnz3BQjbHdUNXeWuAjfR3LoKkKzmHVA8aYrpP8ju d8jye0WRZlEj9aFBLOcc4uGlsV3HDT6FHJK/Zee4yRwXXy4eMNbGqxgZRtpS9g/3xOt+ J5Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720634391; x=1721239191; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aF3CnZV7DMRprpGI4b2ruu391JiaLKZraUtA5FT1zY0=; b=bC6824rHmwT9zwlHn5sCLZ3fJhfztsjBntwJxthcB3Hq+RgP6+O51KGV+K0t+Lql6G 8thpedPu7HP6CCP4cYqRIJ6x3whK0KZL5ngzTonJGYISt3pk5Idx0pa2Xa1dPpESUVT3 g928NkQhy5W+FmEIrY4tuMCdInJ9aFH/gExEupS1mBtdCYerFW/fGuGULIm+QXfaZKxA xWNehZ9eLajYOm1OJ+huRqj+kD5lTcmupAjyCxOP6eZibRpTFJHB2V7Z6K+h9nqBjoCs MJJKzeZ5ZdUOmFet1bh5Xz7SegoEY2hXng62JS+uFPViJyZWicItQakpKhh1BQvVZ8y3 loUQ== X-Forwarded-Encrypted: i=1; AJvYcCWOXdC8Rzod9UdRKhar6i8tosRdg3RgDoMayFeZ3j9Ajg5x1Kn3xoXFzW1iwfH4uZ3NN+xDXHyWo6exVEM90nc9bM8= X-Gm-Message-State: AOJu0YzJXB3o6OY6UeGYb4/cOpDmxeQrjMt1U4fWuihxkn7zcvu+2445 H9KjuqBaeMp4ONPNqNrFpBrSdnacXASVGNpnsR8iepI7HvjrF71rMDCyZ/PBVw2hhjYmV4uyQsy MrxffqRDcHGtGXSehEswdFtz4KB79MQMQ7EhO X-Google-Smtp-Source: AGHT+IFUgm6+kfvtUIojSaSP1JNb9q6BBsgws+EhCtSdyUEJErn22fh9KctlnFuqFkqK/lTFoiBrWOKvvJfQy5snASE= X-Received: by 2002:ac8:6887:0:b0:447:d7ff:961d with SMTP id d75a77b69052e-44d11893b0dmr61151cf.9.1720634391141; Wed, 10 Jul 2024 10:59:51 -0700 (PDT) MIME-Version: 1.0 References: <20240604020549.1017540-1-yuanchu@google.com> <20240604020549.1017540-2-yuanchu@google.com> In-Reply-To: <20240604020549.1017540-2-yuanchu@google.com> From: Yu Zhao Date: Wed, 10 Jul 2024 11:59:13 -0600 Message-ID: Subject: Re: [PATCH v2 1/8] mm: multi-gen LRU: ignore non-leaf pmd_young for force_scan=true To: Yuanchu Xie Cc: David Hildenbrand , "Aneesh Kumar K.V" , Khalid Aziz , Henry Huang , Dan Williams , Gregory Price , Huang Ying , Muhammad Usama Anjum , Kalesh Singh , Wei Xu , David Rientjes , Greg Kroah-Hartman , "Rafael J. Wysocki" , Andrew Morton , Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , Shuah Khan , Yosry Ahmed , Matthew Wilcox , Sudarshan Rajagopalan , Kairui Song , "Michael S. Tsirkin" , Vasily Averin , Nhat Pham , Miaohe Lin , Qi Zheng , Abel Wu , "Vishal Moola (Oracle)" , Kefeng Wang , linux-kernel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 5736F140034 X-Stat-Signature: 1t8umdsqgnh9b5xtk9nmj9i9okuyt864 X-HE-Tag: 1720634392-154114 X-HE-Meta: U2FsdGVkX19sfSoGkJ3kix7yX5M6wj5c5Q9aUrsHwxPWu4unwdABxFc/7pHlb2qrfyDCkRNaM9sCC1wiIMWogbKpOVWEeo5jXzOX1JXpNLeu2xjfrjVhV+Cpc1Ck4tII1719phpJSGlSnT//lSdm+eiztMX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qTaIFSbeFPEqp3wuhprUPhK3vR3ZRdNfOERzdoew0SgfeW4ahOm7hACPQcORMtg== 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: On Mon, Jun 3, 2024 at 8:06=E2=80=AFPM Yuanchu Xie wro= te: > > When non-leaf pmd accessed bits are available, MGLRU page table walks > can clear the non-leaf pmd accessed bit and ignore the accessed bit on > the pte if it's on a different node, skipping a generation update as > well. If another scan occurrs on the same node as said skipped pte. > the non-leaf pmd accessed bit might remain cleared and the pte accessed > bits won't be checked. While this is sufficient for reclaim-driven > aging, where the goal is to select a reasonably cold page, the access > can be missed when aging proactively for workingset estimation of a of a > node/memcg. > > In more detail, get_pfn_folio returns NULL if the folio's nid !=3D node > under scanning, so the page table walk skips processing of said pte. Now > the pmd_young flag on this pmd is cleared, and if none of the pte's are > accessed before another scan occurrs on the folio's node, the pmd_young > check fails and the pte accessed bit is skipped. > > Since force_scan disables various other optimizations, we check > force_scan to ignore the non-leaf pmd accessed bit. > > Signed-off-by: Yuanchu Xie > --- > mm/vmscan.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/vmscan.c b/mm/vmscan.c > index d55e8d07ffc4..73f3718b33f7 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -3548,7 +3548,7 @@ static void walk_pmd_range(pud_t *pud, unsigned lon= g start, unsigned long end, > > walk->mm_stats[MM_NONLEAF_TOTAL]++; > > - if (should_clear_pmd_young()) { > + if (!walk->force_scan && should_clear_pmd_young()) { > if (!pmd_young(val)) > continue; What about the other should_clear_pmd_young() in walk_pmd_range_locked()? With that and the typos fixed, we should probably split this patch out, since it can get reviewed and merged independently.