From nobody Sun Dec 14 13:57:37 2025 Received: from smtpbg151.qq.com (smtpbg151.qq.com [18.169.211.239]) (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 1B2A028DB3 for ; Thu, 16 Jan 2025 07:23:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=18.169.211.239 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737012214; cv=none; b=NwCqhPWGcIMRgBYlz5M72WB4l74YUrgCGDx04hnMSWIEkkOZzHuQNiToQYeOL7u2PIIc0xxhID4fz1FXMnWaUW/Y+T8DgXhfNzMMEHezs4b26sEmZiu00FRqndl40sxjIhRZPmri1uZhb3Sq+q3a372amFTcQ//oD5D7CFCEGcc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737012214; c=relaxed/simple; bh=+4qdaD0wjbu6W8SgUXr8+ItLzhc1S33fZ+AG7M/4cQc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=gb3W+OwggcntHNTGtVhc5iNo4au1CoQdOiYBnZs+xoZ+u4arL/lduLpGIxIJ4VUEeuHW3dszLV37KqP4JrFrYOkw6bI0AcVMJrVTEWxdCT33EDNPB8y4idwUb8wNdENqXvlWbeB3Z0rov6fjZY+xSBXJK3PNSn0qaK7S3uHHupA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uniontech.com; spf=pass smtp.mailfrom=uniontech.com; dkim=pass (1024-bit key) header.d=uniontech.com header.i=@uniontech.com header.b=or3t/yOE; arc=none smtp.client-ip=18.169.211.239 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uniontech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=uniontech.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=uniontech.com header.i=@uniontech.com header.b="or3t/yOE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uniontech.com; s=onoh2408; t=1737012128; bh=AdWzOTY6w7RvGayoavDKbI4N2wMWk2TvLEaUIO3pF3Y=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=or3t/yOExQ7hIYEnkiFHiAe4XQkWRW8QlUrAYhtAEGie4LVp4O2u7obON6vze5nBc /6EpDfQJuG5KLjQQ8spXOwgPf6uo6gBGB4Pz3hUUJMUONNrAAXLEGD01txDUnN6MbQ HPZKLEVVCi9JpOrR/sjmstifhvlWQ7rih71J2CL0= X-QQ-mid: bizesmtpsz5t1737012113t1sesjb X-QQ-Originating-IP: u42jBZHty9sdEqWRb61vcNXgVyNKCBqcsm2aLWkT2Vo= Received: from localhost.localdomain ( [113.57.152.160]) by bizesmtp.qq.com (ESMTP) with id ; Thu, 16 Jan 2025 15:20:49 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 1 X-BIZMAIL-ID: 14316537599261247281 From: Chen Linxuan To: Gao Xiang , Chao Yu , Yue Hu , Jeffle Xu , Sandeep Dhavale Cc: Chen Linxuan , linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH] erofs(shrinker): return SHRINK_EMPTY if no objects to free Date: Thu, 16 Jan 2025 15:20:42 +0800 Message-ID: <433DB98624BCDF95+20250116072042.189710-1-chenlinxuan@uniontech.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtpsz:uniontech.com:qybglogicsvrgz:qybglogicsvrgz5a-1 X-QQ-XMAILINFO: MIXpHopat2IaojCmu/0MpuO+wRaGMSLEStnOjRPHZ3Gi1KEdghlrlsnt RqkSbwlwVYfFRltDlVFDpLOpyVmvVgzQ8MGk3qYvE0Yah7ijTR3CL25DxQ7UKQ0EwPI1wt7 cCNocSIVsWtppgQb+fLAVWRupeEsiyj0aPtlDhVbb59ygJYFMXods6axdmYQsIZLwXNcAsL bc+o48NqcSHy5p4DB/xV2GCtAKy31RdVxLNOjhPFRe8iA6BxwdQ1WrwBhaSBHxZ9QLQDz8X vudUFK5ik0BaX4ia2v7LiYVwART4GMsmcBuZckDSbQF7gBWXd+3V+ofoHlfK5Iug6PGAprj 6VwnWjOVOAxdP2SSXVWPnaLnLml9Vw7CmvtnwUvhut1Atek+LVHKSO14KYk3nuLtdR1zJJx o/mq4PbLKGmbqHQgyc+oFvfRvx14grJpC+01rWXGZ80aB9BDk8v7t9ZCofK0CNY34wxY+RR vxgmmTPKKyte/3enGd/bmDzyadOladbuc4KKjXgnrdIHSYCHkYyNu+FxajdiRK/rW95asON QjJSlFI7ahZNN/fnGYj0dJ+ggDm+Jl4ep+qLymIocwJutom3pohfUtMSNr2k+nAo1OTCqeG uSInlsI31nxsbb6Nw5mgXnxz1rutM/jCFza5nT8d+nAWeo7HeDBrnKWXdM/1eTmsp5MTcUs Zvntr5Xgi1xrsyPhmBG1NfrZEioY32NEp3cULLZqceqBStQyIyI7O5tUFnxyhdS9rFmZ72p DuhzmW0qKABan5jTWc2Qwq7JDVQ/hvQrgIeg0I0HxSOLdsj2s5TiuE5A6QErZcIDEZMQrts z7Utz3udTaZYMSLGw20P1IoqSfmQkS4hNCOueCMMm8fdLpFarVI2v7pQnsNotnc5vIP32KM LDQesvJzgFxD2NDpi0fkyItRdtvbLOoIMC+D+QaYGv2STZfZsTW9dCfnCIt/3Vs5vlQG5gf AenQ0iuvH6ss6x8Po1jL5X/O6KzK1yfe6h7pw4TKZRaiI53qbpEd888IxSGZrI/Ad2SM= X-QQ-XMRINFO: MSVp+SPm3vtS1Vd6Y4Mggwc= X-QQ-RECHKSPAM: 0 Content-Type: text/plain; charset="utf-8" Comments in file include/linux/shrinker.h says that `count_objects` of `struct shrinker` should return SHRINK_EMPTY when there are no objects to free. > If there are no objects to free, it should return SHRINK_EMPTY, > while 0 is returned in cases of the number of freeable items cannot > be determined or shrinker should skip this cache for this time > (e.g., their number is below shrinkable limit). Signed-off-by: Chen Linxuan --- fs/erofs/zutil.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/erofs/zutil.c b/fs/erofs/zutil.c index 0dd65cefce33..682863fa9e1c 100644 --- a/fs/erofs/zutil.c +++ b/fs/erofs/zutil.c @@ -243,7 +243,9 @@ void erofs_shrinker_unregister(struct super_block *sb) static unsigned long erofs_shrink_count(struct shrinker *shrink, struct shrink_control *sc) { - return atomic_long_read(&erofs_global_shrink_cnt); + unsigned long count =3D atomic_long_read(&erofs_global_shrink_cnt); + + return count ? count : SHRINK_EMPTY; } =20 static unsigned long erofs_shrink_scan(struct shrinker *shrink, --=20 2.43.0