From patchwork Wed Jun 22 22:51:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 12891558 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7217CCA479 for ; Wed, 22 Jun 2022 22:51:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359870AbiFVWvy (ORCPT ); Wed, 22 Jun 2022 18:51:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359812AbiFVWvt (ORCPT ); Wed, 22 Jun 2022 18:51:49 -0400 Received: from mail-qv1-xf35.google.com (mail-qv1-xf35.google.com [IPv6:2607:f8b0:4864:20::f35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FC1940A3E for ; Wed, 22 Jun 2022 15:51:49 -0700 (PDT) Received: by mail-qv1-xf35.google.com with SMTP id c1so27038065qvi.11 for ; Wed, 22 Jun 2022 15:51:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FIRVjLUngtzvaOGGJhPX9zs36OvO+dWcUJ0YzPStXJo=; b=RP4Xw5PjLXl1/ttonHyWA6UJqEVlPBaI/VbWuKT2GdpriQ5RbqwHgHOBGOdfOTxTyq TDGa++K8gS/R+55d58vj0W+rk6ukDyJmrWWx/adgrlWS5p6iXgZaCXklmrAQ3/o06bKv sjXJp95JkuuCiMNbBqArpXD5cBjAQs44IfTfg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FIRVjLUngtzvaOGGJhPX9zs36OvO+dWcUJ0YzPStXJo=; b=A35dENIHBhvC6cxevBhU3WdSDPc2HbSNOIxIVipzwycP44zu0NQLBO799LQnw6fqG2 lGMIGf3RfmAU9vlYGKeyr4mUYFWSNS8VGEP/sF5p+tpqM3gL8jIB/lIe1cdsAY2WCWVG e868pOwRiljzD83YoF4BWwV3XetqDfWT3fphfwH/ZCQWIHyY9ARvDH63YfjpsEDXFcvA /Q0PiSRJXpQlBTuKpcPXu4ZHELptIajG6FKMFBRhh4IaOWpXBoZOxXczhCkS3/wt9QgK uH6bLwLc2933xCsl5m5I3pflgffYeNoqh0owXKirDDiJI3j/p1iUrVYQ6WtskBsyvzRA EBiw== X-Gm-Message-State: AJIora/G2ZOoAdxAsojWrrwwSwUIubBfnNda/YLrYXnrka6dxoE32nN8 mGD5P3uLJxtj7ctwSSC2U/NFMjDjNrlnoQ== X-Google-Smtp-Source: AGRyM1vaA5Ao94/E0rX5gloX6owI1QnEQU1eoreWEcsbtCYin0ct2kXn34bL0xAor+gWulrg/0CnCA== X-Received: by 2002:a05:6214:76b:b0:46e:2704:7c42 with SMTP id f11-20020a056214076b00b0046e27047c42mr30212669qvz.90.1655938308765; Wed, 22 Jun 2022 15:51:48 -0700 (PDT) Received: from joelboxx.c.googlers.com.com (228.221.150.34.bc.googleusercontent.com. [34.150.221.228]) by smtp.gmail.com with ESMTPSA id k66-20020a37a145000000b006ab91fd03fasm1794022qke.19.2022.06.22.15.51.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jun 2022 15:51:48 -0700 (PDT) From: "Joel Fernandes (Google)" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, rushikesh.s.kadam@intel.com, urezki@gmail.com, neeraj.iitr10@gmail.com, frederic@kernel.org, paulmck@kernel.org, rostedt@goodmis.org, vineeth@bitbyteword.org, "Joel Fernandes (Google)" Subject: [PATCH v2 8/8] rcu/kfree: Fix kfree_rcu_shrink_count() return value Date: Wed, 22 Jun 2022 22:51:02 +0000 Message-Id: <20220622225102.2112026-10-joel@joelfernandes.org> X-Mailer: git-send-email 2.37.0.rc0.104.g0611611a94-goog In-Reply-To: <20220622225102.2112026-1-joel@joelfernandes.org> References: <20220622225102.2112026-1-joel@joelfernandes.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org As per the comments in include/linux/shrinker.h, .count_objects callback should return the number of freeable items, but if there are no objects to free, SHRINK_EMPTY should be returned. The only time 0 is returned should be when we are unable to determine the number of objects, or the cache should be skipped for another reason. Signed-off-by: Joel Fernandes (Google) Reviewed-by: Uladzislau Rezki (Sony) --- kernel/rcu/tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 711679d10cbb..935788e8d2d7 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -3722,7 +3722,7 @@ kfree_rcu_shrink_count(struct shrinker *shrink, struct shrink_control *sc) atomic_set(&krcp->backoff_page_cache_fill, 1); } - return count; + return count == 0 ? SHRINK_EMPTY : count; } static unsigned long