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 5978D3E8695 for ; Wed, 12 Aug 2026 12:18:36 +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=1786537117; cv=none; b=WJmmvrA6ECF1jBAMULSp9kG6rI7fGIlcxWU4BaX+GsAY809eVndLURszN3v0MK/jXGN00iA8oiZjcP76k/f7Sltozbms/NNGZTMLjva0PEfMPo6/R9SfPGMsnpkoTBnwWa1ScwnyT6bZb9H/c7L0J5C03Rc5BjBT2l2AH2lQQHc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786537117; c=relaxed/simple; bh=YDpMDfAluWaXhaUYKO8VKxIGp7D7Z7+JpXYlxCFhFd4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=oke3N7S7/47PFBOei+vLkSn8kHkUfqZjkOB5BoYUcagzHO0RRTpzG5xUAoTC2da0FYkBzusVlPMPhCylDiQfDHPm6I5j3eIasR5V46KSfWGpYsszfbtp3RDXna637Qt9nRPxLQXElZjU5nH87Lmp7/AgtXdXNpVksmdepI6fSPk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JdxppSf9; 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="JdxppSf9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BBE71F00A3D; Wed, 12 Aug 2026 12:18:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786537116; bh=LWQXEeuSvxK5SjOlteLHcHA1IM+jE7w1Hqw3xSPnRB8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=JdxppSf94PuOpF0SADdQMVWKqkvDo+ItECrjI0+o4AY68ly6P/63VQSpV9X1KgGvN WLuQ8gsxYp4Ngn2vqpqZ1K1tfeslEpCisrI8jcqa7HKPK1lT1stozgK6kIHf0FbywM cxfjEiWnER0RFxYX8Lt5WcfX5410UHVstMh5YMZTBwunWRre6eisUZfCHh4UeVawua RJga6ONZ3Ezai3ZWO8u2ezQw4XdrGTVtQKrjHJj7rZDHnxVuY9KQ0fQ3LF4VjxJAc5 f28gSROyPaRzuegmbNo0x1tPvmYc4CHjDJfv4nYfDjr6Shy4V+dk1pCv/GMuqpaJO6 EB4ah+nlQkUqA== From: "Barry Song (Xiaomi)" To: akpm@linux-foundation.org, linux-mm@kvack.org Cc: axelrasmussen@google.com, 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, baolin.wang@linux.alibaba.com, baoquan.he@linux.dev, "Barry Song (Xiaomi)" Subject: [RFC PATCH v4 08/16] mm/mglru: exclude folios promoted by aging from protected in inc_min_seq() Date: Wed, 12 Aug 2026 20:16:50 +0800 Message-Id: <20260812121658.69965-9-baohua@kernel.org> X-Mailer: git-send-email 2.39.3 (Apple Git-146) In-Reply-To: <20260812121658.69965-1-baohua@kernel.org> References: <20260812121658.69965-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 e0625e6ec919..27623d3bad95 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3948,16 +3948,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