From patchwork Tue Apr 18 07:02:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zqiang X-Patchwork-Id: 13215105 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 C7C93C77B71 for ; Tue, 18 Apr 2023 07:02:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230325AbjDRHC1 (ORCPT ); Tue, 18 Apr 2023 03:02:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229824AbjDRHC0 (ORCPT ); Tue, 18 Apr 2023 03:02:26 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAE88E6D; Tue, 18 Apr 2023 00:02:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681801345; x=1713337345; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=XDMMYnwrW9rxbRKHePPmZPoLDgMsc+ClYkDz3avdfdY=; b=VH/lGvezwBFJa1KmVq573W0CCtrV7gagM6PYlPvFmUSN3rapbqxoEjRx AbLkLLUwIPeFH0Rjsmjkw5jcy3G4XgZpzwM5Ai8p6Xlg9I6V/AwjEDFBD gYcI67i9CUp/HOvlLXmE7zFpiwxdxs4BVtFxdf4T1rHTdG2Zr+EiiXz2H l/UQUyJQCl4mc2AFAGKtFrzoB6f0vQ+HD1/Il3sbbr3mCdTFs1GrW5reu dDHmlB1j72UCFvebKg61mX3cVYEz+u2jVygAfHt75mCpsVsWyDfeQB336 Bvj0C1g1ZUkkrgwH513qz0osw9gm77EUBRBv5jMuD7MHKIn4LuWVZKdKq A==; X-IronPort-AV: E=McAfee;i="6600,9927,10683"; a="407991347" X-IronPort-AV: E=Sophos;i="5.99,206,1677571200"; d="scan'208";a="407991347" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2023 00:02:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10683"; a="690976864" X-IronPort-AV: E=Sophos;i="5.99,206,1677571200"; d="scan'208";a="690976864" Received: from ubuntu.bj.intel.com ([10.238.155.108]) by orsmga002.jf.intel.com with ESMTP; 18 Apr 2023 00:02:22 -0700 From: Zqiang To: urezki@gmail.com, paulmck@kernel.org, frederic@kernel.org, joel@joelfernandes.org, qiang1.zhang@intel.com Cc: qiang.zhang1211@gmail.com, rcu@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] rcu/kvfree: Make drain_page_cache() call return directly if cache is disabled Date: Tue, 18 Apr 2023 15:02:59 +0800 Message-Id: <20230418070259.1353785-1-qiang1.zhang@intel.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org If the rcu_min_cached_objs is set to zero at boot params, the krcp->page_cache_work will not be triggered to fill page cache, and the put_cached_bnode() also does not fill page cache, this also means the krcp->bkvcache is always empty, so not need to acquire unnecessary krcp->lock to get page from krcp->bkvcache, this commit therefore make drain_page_cache() return directly if the rcu_min_cached_objs is zero. Signed-off-by: Zqiang --- kernel/rcu/tree.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index c8ba2be026fa..ce995fc1c644 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -2924,6 +2924,9 @@ drain_page_cache(struct kfree_rcu_cpu *krcp) struct llist_node *page_list, *pos, *n; int freed = 0; + if (rcu_min_cached_objs) + return 0; + raw_spin_lock_irqsave(&krcp->lock, flags); page_list = llist_del_all(&krcp->bkvcache); WRITE_ONCE(krcp->nr_bkv_objs, 0);