From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 04931478E51 for ; Fri, 21 Aug 2026 10:26:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787308001; cv=none; b=M5k8DQ9Q5kw4Jxs9xTiMg73QT2lfMRBh/C0xGQuuQtxo47XB4C9KX4ht2ixZHbbPjYLLffmBHGlvzkbXKFmvh9E2yzfWWkBdAViHen4h+9Jjk+OsCnte7CFfgmqpGJZXCHRoFSIAxRwb5kyrSXmzEBfqAxNu8YJ1vvCnuJrFpXU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787308001; c=relaxed/simple; bh=QBfCMbSODhiumMXzpsnnq/Q/qupUEE06nlRr3gezUNA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RoJl04cAZk9teCA8eH9Ii4y/Jo9cfC66UIGYviydLmYb2icozYHE+gxRO04XWOUF6zXtD7Holxfb53No23HwSSMkC7a/YGbNxObIqRjpl0o7GlcTxmuf0b3GdbOE8/SfOCKIUGv3z6yHBVVUZNCFGjSLW129iXCGvLUijbfx488= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kW2WO3wS; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kW2WO3wS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AECE61F00A3E; Fri, 21 Aug 2026 10:26:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1787307994; bh=bXd8/5/IV3VgMHX6Urv7GKHnjSeWG6/GogM3Cg3sztY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=kW2WO3wSoJLtg6Inb8AuPoDn9JZnzj0GUZW9aneFAAlpqUlseMqxCN/Vjt2rwZItD Wmak52jD6QObp8iy5+IXAi2lk9KhwYUN+4httBpijukH+I0275HsnTWQi4Jij9OkmO 9DPBuk/0Fed3ckWV3uSVkA5H7uoQTdjtJdQYrzNhM00kAzfiOJuTueH3W65JYz35hj NDJv0eQQpQWRT/9HsRtyOTBPcNP4rY32LOHA35D6TJ3YrDIq+CpQWDcEtcF/YOffAB FOezdPShO5gmkBzyKjzBKYcJWPnqwqDY053pkCDvAbP1yzVgdQPSQROJmp1VBZCTBs 3G08JcFDPOLzg== From: "Barry Song (Xiaomi)" To: akpm@linux-foundation.org, linux-mm@kvack.org Cc: axelrasmussen@google.com, baolin.wang@linux.alibaba.com, baoquan.he@linux.dev, chenridong@xiaomi.com, david@kernel.org, hannes@cmpxchg.org, kasong@tencent.com, lianux.mm@gmail.com, linux-kernel@vger.kernel.org, ljs@kernel.org, lyugaofei@xiaomi.com, mhocko@kernel.org, qi.zheng@linux.dev, shakeel.butt@linux.dev, stevensd@chromium.org, wangzicheng@honor.com, weixugc@google.com, yuanchu@google.com, zhangbo56@xiaomi.com, "Barry Song (Xiaomi)" Subject: [PATCH 4/6] mm/mglru: exclude folios promoted by aging from protected in inc_min_seq() Date: Fri, 21 Aug 2026 18:25:36 +0800 Message-Id: <20260821102538.22642-5-baohua@kernel.org> X-Mailer: git-send-email 2.39.3 (Apple Git-146) In-Reply-To: <20260821102538.22642-1-baohua@kernel.org> References: <20260821102538.22642-1-baohua@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Some folios may have been promoted during aging, so don't count them as protected, similar to sort_folio(). Signed-off-by: Barry Song (Xiaomi) --- mm/vmscan.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 3b618a51cde2..7bd01875fade 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3949,16 +3949,15 @@ static bool inc_min_seq(struct lruvec *lruvec, int type, int swappiness) if (gen_increased) { delta += nr_pages; list_move_tail(&folio->lru, &lrugen->folios[new_gen][type][zone]); + /* don't count the workingset being lazily promoted */ + if (refs + workingset != BIT(LRU_REFS_WIDTH) + 1) { + int tier = lru_tier_from_refs(refs, workingset); + + protected[tier] += nr_pages; + } } else { list_move(&folio->lru, &lrugen->folios[new_gen][type][zone]); } - /* don't count the workingset being lazily promoted */ - if (refs + workingset != BIT(LRU_REFS_WIDTH) + 1) { - int tier = lru_tier_from_refs(refs, workingset); - - protected[tier] += nr_pages; - } - if (!--remaining) break; } -- 2.34.1