Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2796398rwb; Wed, 30 Nov 2022 10:59:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf7VNwQgLGHFK7mmIJI3Sr69sZixnjz7oZHNGifcm7z+96Hwwup8mLU9609B9MT7f2VzfSjb X-Received: by 2002:a17:906:aacb:b0:7c0:89b3:b9da with SMTP id kt11-20020a170906aacb00b007c089b3b9damr7446473ejb.275.1669834770197; Wed, 30 Nov 2022 10:59:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669834770; cv=none; d=google.com; s=arc-20160816; b=L7QBypzB4TM+MPOl0tVwGctzIsg8+SLplLWYcbqST3aHB5UPVijZmSPEQ2ynhEtbCs KZzjgIMXHuG0VUDmWPfF/5kGJMNs7Tp4mkmQFxyggbdNgyyVruTv5Z5by/QhECuiO5sy 9Q4T+wYtdTHXWZXsAc+52u7kXCRZD9+bJn3aKyo1Mmg6rwDGQssaSQsQMqBW9KRAFa8P V21NP+dMqHUjLBQyg2Di4RhEqtu0loOnbfFuKNNEc4yAFTsK/oeIiOiNWJTl7HRXYSo/ MMXkOdwAMqgz2220mUXJY4UrUy3sJla1g3zrpPj6qcvxuca2IbzkZbOCo8sNKxVp9gwl /88g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=BZx3c6pdH3tvbbV8hd9d5C+kOw6FjAWMt/tV6RWix8Y=; b=1KdB9jY5j7C7OfCWKUlucEZ40MoJvaeCw5i8YNPnRd6/T1AcMXQ6hm12+WX0UIkgwq V6j6AQJShR3E6Aiw8XViOuy9hZ1xKwZqKodV0K1Tvr4zFJx9OQccR5IMF8Huzy0IYn0t PITaJpiAmKU8i9NlxY548+bAv2sS91frvvWaiEXcCgrE7PTRI5gi/8fTmzQFU3YLKekW sIxERuE55rkGZyHa6KWI9QTt7IQwEOmZag/4pI5RtUkIeWp8YbHFDRLV7ASFGPI+bY+S sNBTDLaZzjsjNvXF6wOy286df1nzUzES4/uuk2+/R6ZiIz5Sae557Nmnd60mJYUkNR0w yEqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=oBDpW4gx; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r18-20020a05640251d200b0046b10fbb1fasi2083022edd.222.2022.11.30.10.59.09; Wed, 30 Nov 2022 10:59:30 -0800 (PST) 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=@joelfernandes.org header.s=google header.b=oBDpW4gx; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230031AbiK3ST3 (ORCPT + 84 others); Wed, 30 Nov 2022 13:19:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230214AbiK3STM (ORCPT ); Wed, 30 Nov 2022 13:19:12 -0500 Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A3DC8D645 for ; Wed, 30 Nov 2022 10:16:22 -0800 (PST) Received: by mail-oi1-x22c.google.com with SMTP id c129so19691113oia.0 for ; Wed, 30 Nov 2022 10:16:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=BZx3c6pdH3tvbbV8hd9d5C+kOw6FjAWMt/tV6RWix8Y=; b=oBDpW4gxowQLjwbJ4RHVMMkexMHrXMKjhTZQiyPABVqPYrQ7s01TUq7w7ZZQI5r4Kc xu0yJ8r8HcgO+Nip5velLlgN0y+gGXA0vL+fjBPBfHGMF/OM2vvp/pnSvvU4WT0/+MIh M71zdaOSYzXBAjKLzTCXd0oAQ3DD1ySOkIDek= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BZx3c6pdH3tvbbV8hd9d5C+kOw6FjAWMt/tV6RWix8Y=; b=hxYHgFG+TzCTzkf3kBTtV4osdGe8Fz2tit9kQc8qa2VSzDtGDwOEH+DNFIKni+Ij0L 07Wyg95qIDDcbmxR9vfKAegdpnuMgk6Bd3Voq/0VFBPjf9MOaba0Nyj9NhWSGx7tQ+P8 A9wdhWjT8GxQ9E6H4VKCBBJKGBi50Z8+4LeYvWGY9yIQiRzT6/KlsUzzC+QO9QIA537i VQVdBmlWAshoWfTGlAQIWUN+0q+bcuqXCt5mKt08JQHzYW1e0UVAzR/84RvFi4Ca/vqq MoJOsurhgpEH1leyvAodJF4sNnWLmGMA3kaaczH55Tg/iVqcjysUMoXxtNkZ5r4b3Ghz WacQ== X-Gm-Message-State: ANoB5plzH+WrC8uMG9HXyBC6g9XwDSqlChhnzFGYQiamNA5jBQlws+v8 KDli0c9vxONFO9+HfPUQJ+nMXErhovU29Y1+E0Jhvw== X-Received: by 2002:a05:6808:1a09:b0:354:4a36:aa32 with SMTP id bk9-20020a0568081a0900b003544a36aa32mr32435098oib.15.1669832181662; Wed, 30 Nov 2022 10:16:21 -0800 (PST) MIME-Version: 1.0 References: <20221130181316.GA1012431@paulmck-ThinkPad-P17-Gen-1> <20221130181325.1012760-14-paulmck@kernel.org> In-Reply-To: <20221130181325.1012760-14-paulmck@kernel.org> From: Joel Fernandes Date: Wed, 30 Nov 2022 18:16:11 +0000 Message-ID: Subject: Re: [PATCH rcu 14/16] rxrpc: Use call_rcu_hurry() instead of call_rcu() To: "Paul E. McKenney" Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, David Howells , Marc Dionne , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-afs@lists.infradead.org, netdev@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 Hi Eric, Could you give your ACK for this patch? The networking testing passed on ChromeOS and it has been in -next for some time so has gotten testing there. The CONFIG option is default disabled. Thanks a lot, - Joel On Wed, Nov 30, 2022 at 6:13 PM Paul E. McKenney wrote: > > From: "Joel Fernandes (Google)" > > Earlier commits in this series allow battery-powered systems to build > their kernels with the default-disabled CONFIG_RCU_LAZY=y Kconfig option. > This Kconfig option causes call_rcu() to delay its callbacks in order > to batch them. This means that a given RCU grace period covers more > callbacks, thus reducing the number of grace periods, in turn reducing > the amount of energy consumed, which increases battery lifetime which > can be a very good thing. This is not a subtle effect: In some important > use cases, the battery lifetime is increased by more than 10%. > > This CONFIG_RCU_LAZY=y option is available only for CPUs that offload > callbacks, for example, CPUs mentioned in the rcu_nocbs kernel boot > parameter passed to kernels built with CONFIG_RCU_NOCB_CPU=y. > > Delaying callbacks is normally not a problem because most callbacks do > nothing but free memory. If the system is short on memory, a shrinker > will kick all currently queued lazy callbacks out of their laziness, > thus freeing their memory in short order. Similarly, the rcu_barrier() > function, which blocks until all currently queued callbacks are invoked, > will also kick lazy callbacks, thus enabling rcu_barrier() to complete > in a timely manner. > > However, there are some cases where laziness is not a good option. > For example, synchronize_rcu() invokes call_rcu(), and blocks until > the newly queued callback is invoked. It would not be a good for > synchronize_rcu() to block for ten seconds, even on an idle system. > Therefore, synchronize_rcu() invokes call_rcu_hurry() instead of > call_rcu(). The arrival of a non-lazy call_rcu_hurry() callback on a > given CPU kicks any lazy callbacks that might be already queued on that > CPU. After all, if there is going to be a grace period, all callbacks > might as well get full benefit from it. > > Yes, this could be done the other way around by creating a > call_rcu_lazy(), but earlier experience with this approach and > feedback at the 2022 Linux Plumbers Conference shifted the approach > to call_rcu() being lazy with call_rcu_hurry() for the few places > where laziness is inappropriate. > > And another call_rcu() instance that cannot be lazy is the one > in rxrpc_kill_connection(), which sometimes does a wakeup > that should not be unduly delayed. > > Therefore, make rxrpc_kill_connection() use call_rcu_hurry() in order > to revert to the old behavior. > > [ paulmck: Apply s/call_rcu_flush/call_rcu_hurry/ feedback from Tejun Heo. ] > > Signed-off-by: Joel Fernandes (Google) > Cc: David Howells > Cc: Marc Dionne > Cc: "David S. Miller" > Cc: Eric Dumazet > Cc: Jakub Kicinski > Cc: Paolo Abeni > Cc: > Cc: > Signed-off-by: Paul E. McKenney > --- > net/rxrpc/conn_object.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/rxrpc/conn_object.c b/net/rxrpc/conn_object.c > index 22089e37e97f0..9c5fae9ca106c 100644 > --- a/net/rxrpc/conn_object.c > +++ b/net/rxrpc/conn_object.c > @@ -253,7 +253,7 @@ void rxrpc_kill_connection(struct rxrpc_connection *conn) > * must carry a ref on the connection to prevent us getting here whilst > * it is queued or running. > */ > - call_rcu(&conn->rcu, rxrpc_destroy_connection); > + call_rcu_hurry(&conn->rcu, rxrpc_destroy_connection); > } > > /* > -- > 2.31.1.189.g2e36527f23 >