Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2816795rwb; Wed, 30 Nov 2022 11:14:07 -0800 (PST) X-Google-Smtp-Source: AA0mqf4KjU1oRAdckEN1MPh2A5DFBiTnsfUK+e3iQVfXU7XKU4wQ5uBzhduNiJBXNjv5f+t9UpdK X-Received: by 2002:a17:906:a212:b0:7b2:804f:a31c with SMTP id r18-20020a170906a21200b007b2804fa31cmr36430538ejy.523.1669835646974; Wed, 30 Nov 2022 11:14:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669835646; cv=none; d=google.com; s=arc-20160816; b=qiNQ3SFtVMdK6VaELLU0Ux+amiVo3JqgfwTnhyI3IVCgJWYqYN7DfQOdkgyA0IGsQF kRAg4fq2z/xjN9CewzCiAzgxPnhO4Q6WXqLfJnx1HvjL/mBPuGTvwgMPQFt+5A11DYUV xS0QD59Ljc2q69VrXNF/mgZTgUVQDEueDzXpi049QmuyT51nqJm00/xAWUsigbOSrhCx O/RHofAwlP6qwkpkETIh5zxVCPOqKlXQaZNqWI6JJeudjmBOQk+qe6l+z4MkA3AtlQcg rEfBFrbwjZ3rznb73rd39NB1L0dQQGvP+JnQI8626c72vet91gBD5Hsc0EI87n/cipyF vycQ== 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=GBXzxdXg5bUAJZPgixzV2JSkMT4QNamcZtjJqxGqukE=; b=LUA9hfLAMKreTagg4NN4Bw+Dn6opVe7EVaJqlphI1mAxxM1AddyppKk0Z71ftJ/svz 6IK3HwPQseuzaaRfq3FTm9oF6rZCE+82EyYOHrXdosc7yz+56LF0Fe424pSB1SWfB2XO uImudjQVnZwWP+OxvzHK1JPp4QUmMvUKQBwhcoKhbJnnvaHMafewn610DwM0IFOlZgXz 4DruntcrNMQsLkjAsls4KhTycR5WRTQphZyZ1tapqPqnonU+57glE8sNq9+y3CR5jWFv pELyTT9lY24PC3wiEE1lN0PPmDoNKGqDdN49RMBqo11RRAI8dDGpVBHnBJpec6V6TbL4 1J+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b="fg7+/lcS"; 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 d24-20020aa7ce18000000b0046329e2724dsi2033448edv.86.2022.11.30.11.13.46; Wed, 30 Nov 2022 11:14:06 -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="fg7+/lcS"; 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 S230132AbiK3SUD (ORCPT + 83 others); Wed, 30 Nov 2022 13:20:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230323AbiK3STa (ORCPT ); Wed, 30 Nov 2022 13:19:30 -0500 Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 401828DBF2 for ; Wed, 30 Nov 2022 10:17:10 -0800 (PST) Received: by mail-ot1-x335.google.com with SMTP id g51-20020a9d12b6000000b0066dbea0d203so11749594otg.6 for ; Wed, 30 Nov 2022 10:17:10 -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=GBXzxdXg5bUAJZPgixzV2JSkMT4QNamcZtjJqxGqukE=; b=fg7+/lcS2nkQfkY0N86X1M19BkSqKl1vYg7sG7AL8ukRjAlvjhPwur37ZYAsB4bv17 Vw1BUczBwS8GXipFTUVDtXXlnJyZIWyk6impQU4sSBLBSbzIbP7eL8L4dr16x+XcFz1i y37jFI6zl9h4GxP5S3QqejwV/047FoquCuQF0= 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=GBXzxdXg5bUAJZPgixzV2JSkMT4QNamcZtjJqxGqukE=; b=UTTK9NtBrrxtI9/ohU6nw7KmvmKvgbggF7e6hSx/EbZ24umfSw5zSgtJF78U95m9m2 0iHbP4m3I46v/qPWP/SkAH04c2QnelXI1+8zndqajbZYR7zs1oeJPjbhvS0eg8ZIhVQQ Bm1Dq7cWFfUOThY8DzarOGePKj8NYdScBcT5EYbi+38vAk40jJ86W0XTDfWnq7BHR3B/ Fs7xLIfNB1aCXgTffJ/stmQI21CyUtsXNNP4qABUTDHvML1Ojyhp9Q2IjfbWruDlEBrM k0rQhvc/yD73asX8mK52ExeF53/MchTWZ63MgXzEIRbcNfYXGQiaYl6Zh3SbbkRuwGvl iJOg== X-Gm-Message-State: ANoB5pngwPoZtXPXdzE36N6RITgLFqZ/r672CUVvy+tEIuMbg5DQayTh 6ZWpi4vUfix9mzMVnbOC3Q9aJ5qnqwZmaJHSMF54AbX+ZKWMfuCY X-Received: by 2002:a05:6830:d03:b0:66d:3e45:8e5a with SMTP id bu3-20020a0568300d0300b0066d3e458e5amr20987786otb.177.1669832229511; Wed, 30 Nov 2022 10:17:09 -0800 (PST) MIME-Version: 1.0 References: <20221130181316.GA1012431@paulmck-ThinkPad-P17-Gen-1> <20221130181325.1012760-15-paulmck@kernel.org> In-Reply-To: <20221130181325.1012760-15-paulmck@kernel.org> From: Joel Fernandes Date: Wed, 30 Nov 2022 18:16:58 +0000 Message-ID: Subject: Re: [PATCH rcu 15/16] net: Use call_rcu_hurry() for dst_release() To: "Paul E. McKenney" Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, David Ahern , "David S. Miller" , Eric Dumazet , Hideaki YOSHIFUJI , Jakub Kicinski , Paolo Abeni , 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 for this one as well? This is the other networking one. 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:14 PM Paul E. McKenney wrote: > > From: "Joel Fernandes (Google)" > > In a networking test on ChromeOS, kernels built with the new > CONFIG_RCU_LAZY=y Kconfig option fail a networking test in the teardown > phase. > > This failure may be reproduced as follows: ip netns del > > The CONFIG_RCU_LAZY=y Kconfig option was introduced by earlier commits > in this series for the benefit of certain battery-powered systems. > 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. > > Returning to the test failure, use of ftrace showed that this failure > cause caused by the aadded delays due to this new lazy behavior of > call_rcu() in kernels built with CONFIG_RCU_LAZY=y. > > Therefore, make dst_release() use call_rcu_hurry() in order to revert > to the old test-failure-free behavior. > > [ paulmck: Apply s/call_rcu_flush/call_rcu_hurry/ feedback from Tejun Heo. ] > > Signed-off-by: Joel Fernandes (Google) > Cc: David Ahern > Cc: "David S. Miller" > Cc: Eric Dumazet > Cc: Hideaki YOSHIFUJI > Cc: Jakub Kicinski > Cc: Paolo Abeni > Cc: > Signed-off-by: Paul E. McKenney > --- > net/core/dst.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/core/dst.c b/net/core/dst.c > index bc9c9be4e0801..a4e738d321ba2 100644 > --- a/net/core/dst.c > +++ b/net/core/dst.c > @@ -174,7 +174,7 @@ void dst_release(struct dst_entry *dst) > net_warn_ratelimited("%s: dst:%p refcnt:%d\n", > __func__, dst, newrefcnt); > if (!newrefcnt) > - call_rcu(&dst->rcu_head, dst_destroy_rcu); > + call_rcu_hurry(&dst->rcu_head, dst_destroy_rcu); > } > } > EXPORT_SYMBOL(dst_release); > -- > 2.31.1.189.g2e36527f23 >