Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp5320510rwe; Tue, 18 Apr 2023 05:28:33 -0700 (PDT) X-Google-Smtp-Source: AKy350ZtkROYGH8t09RRni0/9mnOnXdylmXJIiX2TafVU6/S4jqvnaHUw8MZFpbVr8vlPwnCu3wJ X-Received: by 2002:a17:903:41c9:b0:19a:7f4b:3ef6 with SMTP id u9-20020a17090341c900b0019a7f4b3ef6mr2271929ple.3.1681820913448; Tue, 18 Apr 2023 05:28:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681820913; cv=none; d=google.com; s=arc-20160816; b=acT3bA3ZozfsZyrJSW+J560M9avNgo2CyVZ/VQt2upmk47kB7PwMQ0kNxco4fUqYQl swOf4lw2yQjLLH2Z/YlMSZgnUXAq1CtjRCcUHtYDx1Q15pDUa4wjXfiQkn2zarSvqF9Q mSLNemVZbsLONt1Wg8UYROV19+QMRlxvDmel9bYHjMwDTCA7qqr7UhETahA5y1C11hJU MxddkRh7XaARn3LavUhC1vFcoD58uGUBNCI83Z9stDhly17qti+neE8Gy0F5yQOXiHL0 XxguufhgWW3rP2jdlRSbs9vm4MmNsl97+1S+uMzZp4OVszsSKTbmct+bazeI5PTD8BW8 LrlQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=TNCc5kW6RBIVqC24Q/mws1OfzvrFAw8eqvME3y6Qalg=; b=sc7WGKgc5a2JL3IhXUxwi7ARgRFHLyIpxoF4R4+Lqx9NRRYFXmDaxRn2e69w79b1Kq l3meSLmMsTiDIwKl2q9MFISmZTDUWVhyjG2S3Treh4bMKAOqw8akEY2VEfBeRwwomo6E x65+99+3Wpc3Nb+hbPS/87RJTU2VxuL/5wIuOaZze0RWHim6EbZKqVCP7fW9XcTwLP/t HcFz/pBhf0cVAXmrLcL6ytaZlkjDmjhz20TDx3po2UAQdgivsRku6pdLzn0ouzQS+Dqo wOP0mW0J0sPpOruFf79MhrWUc9iIFQ2zq2B2rv/MYRiK612/IZWZcGHDAsm2OzqYWnBP 2lkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=I7pBlM3v; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ix22-20020a170902f81600b001a52bb7ef82si13894747plb.119.2023.04.18.05.28.18; Tue, 18 Apr 2023 05:28:33 -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=@intel.com header.s=Intel header.b=I7pBlM3v; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231153AbjDRM2E (ORCPT + 99 others); Tue, 18 Apr 2023 08:28:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230518AbjDRM2C (ORCPT ); Tue, 18 Apr 2023 08:28:02 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19348AD2F; Tue, 18 Apr 2023 05:27:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681820853; x=1713356853; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=ZoBHkceirvJNWzt8LE9+6lPalvhAJ4iyS7QP1CpAK54=; b=I7pBlM3vWZiYJFp3mmdhtoYSpfUnINuMjEojGVhZb5ZSdlNObLGH3vGj lZpgyXTPrXOQeeFm7c9XSS/EFa/k4V6lEFp2EunLAdyjxKH5NDL19ltqi Vfua2M63anawzKe41k+09tg1LleqvAcWLWtkc1jFW+U3yeO/HpkIwo+dH oTbwlF926Hz4q6V94Y/AAE3wIZAz8I25aHlNp6+C9sDqp96VDDmOrkfSO YC6RHctxkrrZqeiTZdZXaeOtZznUfC7ADW4BATHCjJCxhilhHTQojiSbM hcVoak47P3oZP/zL00kwFZ+1FWpkTZhlWZA/yjeMsvgP+OqA7dWwqgzYt Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10683"; a="408055609" X-IronPort-AV: E=Sophos;i="5.99,207,1677571200"; d="scan'208";a="408055609" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2023 05:26:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10683"; a="723607627" X-IronPort-AV: E=Sophos;i="5.99,207,1677571200"; d="scan'208";a="723607627" Received: from ubuntu.bj.intel.com ([10.238.155.108]) by orsmga001.jf.intel.com with ESMTP; 18 Apr 2023 05:26:26 -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 v2] rcu/kvfree: Make drain_page_cache() call return directly if cache is disabled Date: Tue, 18 Apr 2023 20:27:02 +0800 Message-Id: <20230418122702.1378299-1-qiang1.zhang@intel.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 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 93faf9f5c58f..00620a2117de 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); -- 2.32.0