From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-124.freemail.mail.aliyun.com (out30-124.freemail.mail.aliyun.com [115.124.30.124]) (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 E36623E171C for ; Mon, 29 Jun 2026 08:04:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782720268; cv=none; b=r/4AIORt1wJ2rrSvf93wiQy4W1kG4/R/x8bK8Qgji5+JQ79OHK8df1C7HUi2VvTtL+f9/aRjTUvcDkHvsNyeKfG2eX4duchJmSVAxuMdw9cCNFTYIoRmmK//kJ92STM7s6khcyfq2Rb48nZ0WJ50afjA1pSqmFMoHe9VFgYzQi8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782720268; c=relaxed/simple; bh=gD79mnumFurRiXiPkKirzhDemx49MWRxCerZG0YMvs8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=BSL1ejVMIoH5gzWWUojDKEDO5OUUViGAnLC33dovrR4qETgNO75Thg12VX8blqB3k2rvP7Z2GFxkozH35LqBz7HaErAfyiXWR02m8dHx4fz0E6pEsOrJHF6/h9GIaVuQntzXJ0D3UEuHsua//wFC6FGfKmY+gR0F1gPCoa06hRM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=Pkkz+KTL; arc=none smtp.client-ip=115.124.30.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="Pkkz+KTL" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1782720261; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=83iBgkm51rIv1+lt3fvIipGPuFGfW+56rCub8m7tfiU=; b=Pkkz+KTL9fW2xlCUdBxdQGK/T1zJZpOGg57guurE0443iJlApJ/1GFOp5bItDsQ/eJ0PbavD2YWAqZ35JBCHtiTJshgtiRefR+nPvg4vp32h+N1ZaxJ5P9UNW61AYj/dzhuRk61stJTOHN/51kAvEBbiGt5/wriLTEmWI6ixLBc= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037009110;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=15;SR=0;TI=SMTPD_---0X5pEijK_1782720259; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0X5pEijK_1782720259 cluster:ay36) by smtp.aliyun-inc.com; Mon, 29 Jun 2026 16:04:20 +0800 From: Baolin Wang To: akpm@linux-foundation.org, hannes@cmpxchg.org Cc: kasong@tencent.com, qi.zheng@linux.dev, shakeel.butt@linux.dev, baohua@kernel.org, axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com, david@kernel.org, mhocko@kernel.org, ljs@kernel.org, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm: vmscan: remove the redundant FOLIOREF_RECLAIM_CLEAN logic Date: Mon, 29 Jun 2026 16:04:06 +0800 Message-ID: X-Mailer: git-send-email 2.43.5 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit folio_check_references() will return FOLIOREF_RECLAIM_CLEAN for referenced file folios, indicating that we can proceed to reclaim clean file folios or keep them if they are dirty file folios. However, after commit 6b0dfabb3555 ("fs: Remove aops->writepage"), we no longer attempt to write back filesystem folios through reclaim. Instead, we always activate dirty file folios and wakeup the flush workers to write them back. As a result, the FOLIOREF_RECLAIM_CLEAN logic is now redundant: for dirty file folios, we will no longer reach the 'references == FOLIOREF_RECLAIM_CLEAN' branch in shrink_folio_list(). Additionally, lazyfree folios are also placed on the file LRU list, but if a lazyfree folio becomes dirty, try_to_unmap() will fail and thus prevent reclaim of the re-dirtied lazyfree folios. Therefore, we can drop the FOLIOREF_RECLAIM_CLEAN-related logic. Signed-off-by: Baolin Wang --- mm/vmscan.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 299b5d9e8836..2f7e5878faa5 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -823,7 +823,6 @@ void folio_putback_lru(struct folio *folio) enum folio_references { FOLIOREF_RECLAIM, - FOLIOREF_RECLAIM_CLEAN, FOLIOREF_KEEP, FOLIOREF_ACTIVATE, }; @@ -920,10 +919,6 @@ static enum folio_references folio_check_references(struct folio *folio, return FOLIOREF_KEEP; } - /* Reclaim if clean, defer dirty folios to writeback */ - if (referenced_folio && folio_is_file_lru(folio)) - return FOLIOREF_RECLAIM_CLEAN; - return FOLIOREF_RECLAIM; } @@ -1235,7 +1230,6 @@ static unsigned int shrink_folio_list(struct list_head *folio_list, stat->nr_ref_keep += nr_pages; goto keep_locked; case FOLIOREF_RECLAIM: - case FOLIOREF_RECLAIM_CLEAN: ; /* try to reclaim the folio below */ } @@ -1381,8 +1375,6 @@ static unsigned int shrink_folio_list(struct list_head *folio_list, goto activate_locked; } - if (references == FOLIOREF_RECLAIM_CLEAN) - goto keep_locked; if (!may_enter_fs(folio, sc->gfp_mask)) goto keep_locked; if (!sc->may_writepage) -- 2.47.3