Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1472949rwi; Wed, 19 Oct 2022 11:01:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6dPpp8oOPqHZYLETjEfQyr4ILe4z8p9LuMcdp1ii4jgBvs24+Tl8mtpJLPK5gYjn4BR7Ew X-Received: by 2002:a17:907:8690:b0:791:9f83:6872 with SMTP id qa16-20020a170907869000b007919f836872mr6692890ejc.386.1666202486636; Wed, 19 Oct 2022 11:01:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666202486; cv=none; d=google.com; s=arc-20160816; b=QBYAOr0eWyBZEDGq8Q3UXsjOAAhIS2PM9F+Hk5vLbzYtG3lZMIMDsSbE6p+LYXJ4e7 x+9WkH/BYajJ4ZMw3QRyZLuV4xaYu6a2MIQVAjsvc0fh7aL+pf9t9cUEYUVzA2udbWrC I7ltwCb7MlfIaWSIXCDUbGVXkkBtnr7x/VQoiPpqOwh998Vprft1FV8C+SsV8dsuPeNJ PiQwIDGx9DkPkD2pVrpxYutO+LASeNSiHGCvtO03ugqtQY6Loli0c8+/eq49P80erbR7 Mn5mC+MXvJk1k+TFa6IfRv2ighRcN6Q0WLnFJ8iSkCownaAHfBnHSLbjnDsSBIRUkT7z CrzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=yGJflaDZ3KF9pqv/Ev5OWnsg5nWi2jDY4vO6xGlkOIE=; b=KunOK/4tmnnzPCvjTMUDXSCotxe6MppyTSjwErMj9GT6L6AUV8zgHOmPeo1okLBauL bWMIVi+cxRBLCXgg5RkZLjoRk0j5xqtFfrQes7/D4VV2rcr69Jl89jrSiTLQ+vMKndve ViCBMq/eZYEtP9/kC12LOj+komUVVGrwlK2y8tpdjHMiT97gYnyv4rdJ279eXWEcG5p/ jbZBp4FGIDBoeRFCTtP1JyAXCqE/6YmWlbUQiaYUtwczUshsFt1fkpLx6wAlEEP9NSkn 6KO2pLwthlAf5wpMBj4QAz4UHPbGQEJpTjuDvCeCh0c3FtTBR0YQVpMuvKTaYUWlGCFs gpSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=a4ZQTiFg; 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 hd8-20020a170907968800b00791a37e664fsi3886460ejc.906.2022.10.19.11.00.57; Wed, 19 Oct 2022 11:01:26 -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=a4ZQTiFg; 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 S231342AbiJSRpD (ORCPT + 99 others); Wed, 19 Oct 2022 13:45:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231218AbiJSRpB (ORCPT ); Wed, 19 Oct 2022 13:45:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C7ED103D87; Wed, 19 Oct 2022 10:44:59 -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 26C6761984; Wed, 19 Oct 2022 17:44:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F993C433D6; Wed, 19 Oct 2022 17:44:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666201498; bh=TY3Uw+0Ns5PZLGxTpKA9rqUhndKRKfptNAqFbQfXUpc=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=a4ZQTiFg/oYQVKEJ/ttMK/JDMU7KOH8Z7LBMi26f0WRT4dbVpddTWKAAPuUckOaUk o6fYr3kFy0aCet7spC289fis8xKS0vwyTi3/9eHhTdi4oK4OIAArmn6oSO/R2xYrWj OvyxhZ5CLcBJW5vuggFe/0oYHyvWyOqTXahTEBCKEux5lgXmsdqzcMrGV5t1fLFz+h 9RPHfKvx6eRbZGfAIGIIuNLEhOIFCY9Pds0VUJDvcT9KM6OzulYQ3tl82CUo6zIWXP JiX7gm2XLtGIaEAYXQwLmjmjSTmYQbNcRfeBVSLPMssKZdufeitysOPMgv6TpGWtHD Z4gd0lVdYPZ0g== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 1D1F55C06B4; Wed, 19 Oct 2022 10:44:58 -0700 (PDT) Date: Wed, 19 Oct 2022 10:44:58 -0700 From: "Paul E. McKenney" To: Joel Fernandes Cc: Zqiang , frederic@kernel.org, rcu@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] rcu: Make call_rcu() lazy only when CONFIG_RCU_LAZY is enabled Message-ID: <20221019174458.GD5600@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-7.4 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 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 On Wed, Oct 19, 2022 at 08:12:30AM -0400, Joel Fernandes wrote: > > On Oct 19, 2022, at 8:10 AM, Joel Fernandes wrote: > >> On Oct 19, 2022, at 6:34 AM, Zqiang wrote: > >> > >> Currently, regardless of whether the CONFIG_RCU_LAZY is enabled, > >> invoke the call_rcu() is always lazy, it also means that when > >> CONFIG_RCU_LAZY is disabled, invoke the call_rcu_flush() is also > >> lazy. therefore, this commit make call_rcu() lazy only when > >> CONFIG_RCU_LAZY is enabled. First, good eyes! Thank you for spotting this!!! > >> Signed-off-by: Zqiang > >> --- > >> kernel/rcu/tree.c | 8 +++++++- > >> 1 file changed, 7 insertions(+), 1 deletion(-) > >> > >> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c > >> index abc615808b6e..97ef602da3d5 100644 > >> --- a/kernel/rcu/tree.c > >> +++ b/kernel/rcu/tree.c > >> @@ -2839,7 +2839,6 @@ void call_rcu_flush(struct rcu_head *head, rcu_callback_t func) > >> return __call_rcu_common(head, func, false); > >> } > >> EXPORT_SYMBOL_GPL(call_rcu_flush); > >> -#endif > >> > >> /** > >> * call_rcu() - Queue an RCU callback for invocation after a grace period. > >> @@ -2890,6 +2889,13 @@ void call_rcu(struct rcu_head *head, rcu_callback_t func) > >> return __call_rcu_common(head, func, true); > >> } > >> EXPORT_SYMBOL_GPL(call_rcu); > >> +#else > >> +void call_rcu(struct rcu_head *head, rcu_callback_t func) > >> +{ > >> + return __call_rcu_common(head, func, false); > > > > Thanks. Instead of adding new function, you can also pass IS_ENABLED(CONFIG…) to the existing function of the same name. I do like this approach better -- less code, more obvious what is going on. > > Looks like though I made every one test the patch without having to enable the config option ;-). Hey, I’m a half glass full kind of guy, why do you ask? > > > > Paul, I’ll take a closer look once I’m at the desk, but would you prefer to squash a diff into the existing patch, or want a new patch altogether? > > On the other hand, what I’d want is to nuke the config option altogether or make it default y, we want to catch issues sooner than later. That might be what we do at some point, but one thing at a time. Let's not penalize innocent bystanders, at least not just yet. I do very strongly encourage the ChromeOS and Android folks to test this very severely, however. Thanx, Paul > Thanks. > > > > > Thanks. > > > > - Joel > > > > > >> +} > >> +EXPORT_SYMBOL_GPL(call_rcu); > >> +#endif > >> > >> /* Maximum number of jiffies to wait before draining a batch. */ > >> #define KFREE_DRAIN_JIFFIES (5 * HZ) > >> -- > >> 2.25.1 > >>