Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2817540rwb; Wed, 30 Nov 2022 11:14:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf4oSeNk74k6icQEEiQq0MJEU6BKqLlUt7IS2RU6HDNPO3rwCJNlYrorgQd82LGrHBTqHNAW X-Received: by 2002:a17:906:4ec4:b0:7bb:4880:b6fd with SMTP id i4-20020a1709064ec400b007bb4880b6fdmr27683541ejv.170.1669835686056; Wed, 30 Nov 2022 11:14:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669835686; cv=none; d=google.com; s=arc-20160816; b=SeZYytf6KJ7fX9dHsYwqnBRvrG844D4zozQQASax1iRVG3Oq+C6ChGayPxzq7GTQb5 sou+sJjdewB7rBRjbyB79Eyzr3JqyTpWAe5XqBol22H1lvNgjcrQMAJvfnprGrkpepG+ x3bstIPfVcqGjoPy491D+5NOWxWifYN148dS8sNRo6c46seKW7gQ/CJJmoi6LYEJW4B3 Y02bsFmaa/CHoUgsajVdnLYmHlIwFi6cVKm5QC/9X5o7AdEie7eyfw6dI+13g10Ae435 J32S4HNIwxI6ScMI4ps98qWqGrjUZgEgvC09mEfToAFUm6UjZ/6UIatcxVDHkCfCFSYv xnKQ== 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=TWoxc95kHVoWpknIf60loTlL+l1uOQrqfMxpVoQ4FLs=; b=uXyOrvpcNmhSpZensY+ssttBdq463rsZ8mfwTjCbn1TJudsD+TDa1o4cD4WZ58eipp 48SbHz2zx9oTCabJ1VwWWYE7N61aja0qgbLKrh99OWfT0UiKMQuzNo44NkARBiYfozgH qfz4mzgaqaLptVl2PMLRIoPcTAQOSkDVWmiswpXhOJeEUJmpRyJSvd/sN8l16b2THkjb +PMoHG8fUYIJX6EOwctl0jcjBCkg0Bnv8SZ7nMdZO1mNszTEsU03kjX1oHvC2no+Am07 AruqsMyMsX0oV9oxZg+dDseCSJwAUytHXY4jp+KhCn3PD6iEnL2Ls63zDkPf7/geE3oO T/2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=iaHBSo+r; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 3-20020a170906328300b007827639faffsi1451697ejw.760.2022.11.30.11.14.24; Wed, 30 Nov 2022 11:14:46 -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=@google.com header.s=20210112 header.b=iaHBSo+r; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230459AbiK3ShZ (ORCPT + 83 others); Wed, 30 Nov 2022 13:37:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230418AbiK3ShV (ORCPT ); Wed, 30 Nov 2022 13:37:21 -0500 Received: from mail-yb1-xb2d.google.com (mail-yb1-xb2d.google.com [IPv6:2607:f8b0:4864:20::b2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3091E93A48 for ; Wed, 30 Nov 2022 10:37:19 -0800 (PST) Received: by mail-yb1-xb2d.google.com with SMTP id v206so5988043ybv.7 for ; Wed, 30 Nov 2022 10:37:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=TWoxc95kHVoWpknIf60loTlL+l1uOQrqfMxpVoQ4FLs=; b=iaHBSo+r2xkjuhr+NuKX+d2/hf3C02PYqzGrInu0/GPH8YyqqkmULsnTv3tLxAf6Uh 1mdELNX4DGfaJfOiH0/jJMvycGAo+2YhREt8mD+LJRVuqzH3dP699+Ru+XH+n45XLHFp WYCFXm7h+OH+aFWfYY6/RRL6a9H/1fHyn3cdHWATNwQW8uOqDUkmiLH8bZv7cQV2+IVp nG8oqZeCEfu8WlvnLXmjG3IJIXHVAv1mwbrZOdy6Dn1OfA8GI1M7xAYnmaWYAOctMokT wdHcnLjgcJiKwyFZ532P1PRW5h91fgnH1j8Fs4t4CMQNOFDQ0G4ladLkjhzuumA85S3N 8saw== 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=TWoxc95kHVoWpknIf60loTlL+l1uOQrqfMxpVoQ4FLs=; b=kSMDy0NcadW5g8cjzNLm22Igr9YHaMCL9QEXb7L/K9OXE3cGA4uTLvT9B3DUVURROW HMqq+wlxXjgoPzMLZVkeB+6ejwjzDYpMOG259QNdittIPC6DE13ckOOr0sOA/XW+J5mh UKXQUAb81SSlC3nush2loLda0+z0VWKfTsvAJa6DIF/AbBi6Jbd9cqZkRENaRFg/Wxxe MPccWbY1ZPY9jHwJ5LrLQwvFIZoDm8DXm6eWaUz/FVPPxPPeFnRPeC0f3Di49M1E4p6z vKbM2kA7qj7jvGibtDv0bgrrfXHqXyPmkc2uUvwlHnnFqHUGjI7Gxx4lyeqWWQ/aMMAh pNpg== X-Gm-Message-State: ANoB5pnX90Mr7FWyBNexkeJdb9h6Zof+DN67oi2/C8XXS7YZq83YyrlS DN1w9Jh3Ya+Bwu2XzqvinidbX1nlEc1Ff3SOwVAIwg== X-Received: by 2002:a25:2546:0:b0:6f0:b332:f35e with SMTP id l67-20020a252546000000b006f0b332f35emr33717018ybl.55.1669833438126; Wed, 30 Nov 2022 10:37:18 -0800 (PST) MIME-Version: 1.0 References: <20221130181316.GA1012431@paulmck-ThinkPad-P17-Gen-1> <20221130181325.1012760-14-paulmck@kernel.org> In-Reply-To: From: Eric Dumazet Date: Wed, 30 Nov 2022 19:37:07 +0100 Message-ID: Subject: Re: [PATCH rcu 14/16] rxrpc: Use call_rcu_hurry() instead of call_rcu() To: Joel Fernandes Cc: "Paul E. McKenney" , rcu@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, David Howells , Marc Dionne , "David S. Miller" , 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=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 Ah, I see a slightly better name has been chosen ;) Reviewed-by: Eric Dumazet On Wed, Nov 30, 2022 at 7:16 PM Joel Fernandes wrote: > > 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 > >