Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7628757rwr; Wed, 10 May 2023 10:26:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6+gW18T0WI2rhqbhWOAyVNPUiwxxhm1E3/saRat6AZieOL1IRlJ1FFwBZHUjEarEhiRE8K X-Received: by 2002:a05:6a00:2e8f:b0:63d:2343:f9b with SMTP id fd15-20020a056a002e8f00b0063d23430f9bmr26153748pfb.19.1683739598829; Wed, 10 May 2023 10:26:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683739598; cv=none; d=google.com; s=arc-20160816; b=gxyD26HflkyWv/m9UkilFEZTiZT/1djt51Q3ZBvsM0ROtlX3b2KK9CsryGBjFzkWF1 TYMxDVkzlIQn8XGo8QH/RxfQZ8TJcPMFIcuPgwY/ewEW3p/7LRGav2t0ptLdWr42SEqV /p3D4OOEqYdnmYcBqW37mfxmvtnrw7s+SvIPaPnErY4eHhStfNQWmkA1qEm/QU6nEg23 h37pli/8g2C40lDQIrjNdZrP7IcY/m+HTJ/A2TqRYDbS7nOTymNoe0pHR/2qqI+ibLcs BUIqzdAOGdA/MRGRkixvct3voUSpEh464s5WaW6YJ+/23pxwFyFuOo/mYQjgXEf275CL 7DOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5JQrQoRbQR2z7WmUIPQiKjJT167VjfnpGPWLXycU+jg=; b=hcE4QwB9nSJGe1gpJUXhgGZsAfWjz81AKqbtqncHn0UjvCrIRC2P9zfuhHndm43kAp k9Y86kJx1BmxWXkgfzVlAZA6LGlb2GB67nxw7jYdNmp7pA0HATp7AlzYKqHqUYu3ppPh bUQ2uU0a0Sk1TMCsoFxa6NV6d06sAsqptBSeHsU0XJ9QxsKYBbOIyP20toRFTeMZ7+2g JPJyVTuSe6GkgrlCoVodSXCxRJIIu3UKvsDbw3/LDw6EmCw8qDh/1U5X1TwpXbhfTtD0 dSElpZ3eLmC5qV8VpNtAQBye3bZvugnAp85sUZUp33VSUbOi7iyNWwRTNRB60t5f4Jw3 ScfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LPDDps13; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y84-20020a626457000000b0063b356e36fesi5382576pfb.372.2023.05.10.10.26.24; Wed, 10 May 2023 10:26:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LPDDps13; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236357AbjEJRDf (ORCPT + 99 others); Wed, 10 May 2023 13:03:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236319AbjEJRD2 (ORCPT ); Wed, 10 May 2023 13:03:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C44B115; Wed, 10 May 2023 10:03:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CE8FF64A2D; Wed, 10 May 2023 17:02:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F46BC433A7; Wed, 10 May 2023 17:02:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683738164; bh=T2PP2RT6SZHp2JZxt61wF7BysGP/eXTSVvR5ZsRLK6E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LPDDps13cQGMdapFCTpx/0au0jFJD6sUSA3QEFhJN7jDo1Xz4JVaeF7oE1A1h5QLN LTsLOSn1vU6q7Huq67ko2XK6WcB8UI/vmcfPLFe1gCZMoxUOqig4zeVmC2yYkRt99L 8IEipqOgSjpRemuN1kJRFIig1Do3hp9z8+q+d8rdmBmPgOmRNx2jERhRWTAKgMPUtb 1Tme4AaYcVLjNOVLgEdbBEBfd79pPZXCNuxtBH0x5LI4yw4Qmr+R4hSh7trNKUbgmT sSh7JzxOeW+xY71EsBZIohxPFayfbJIShqENsn+sQceXT/N0WL1jgU/HlgyF6h395e wzXUhanZwEfcg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 5C666CE1349; Wed, 10 May 2023 10:02:43 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, Zqiang , Uladzislau Rezki , "Paul E . McKenney" Subject: [PATCH rcu 8/8] rcu/kvfree: Make drain_page_cache() take early return if cache is disabled Date: Wed, 10 May 2023 10:02:42 -0700 Message-Id: <20230510170242.2187714-8-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <1c01c38f-3783-44d7-8c11-7416cd5b849c@paulmck-laptop> References: <1c01c38f-3783-44d7-8c11-7416cd5b849c@paulmck-laptop> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zqiang If the rcutree.rcu_min_cached_objs kernel boot parameter is set to zero, then krcp->page_cache_work will never be triggered to fill page cache. In addition, the put_cached_bnode() will not fill page cache. As a result krcp->bkvcache will always be empty, so there is no need to acquire krcp->lock to get page from krcp->bkvcache. This commit therefore makes drain_page_cache() return immediately if the rcu_min_cached_objs is zero. Signed-off-by: Zqiang Reviewed-by: Uladzislau Rezki (Sony) Signed-off-by: Paul E. McKenney --- kernel/rcu/tree.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 98f2e833e217..00ed45ddc6ca 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -2902,6 +2902,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); -- 2.40.1