Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2356750rwb; Sun, 15 Jan 2023 13:59:57 -0800 (PST) X-Google-Smtp-Source: AMrXdXslTZbGiR5seqcy2mFhoo3zVZyc8hJUkrXnRIdefOqqB90pptkjCxQnghB/eG1lODIHVUvU X-Received: by 2002:a17:902:f604:b0:192:55ab:88fe with SMTP id n4-20020a170902f60400b0019255ab88femr100118749plg.56.1673819997029; Sun, 15 Jan 2023 13:59:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673819997; cv=none; d=google.com; s=arc-20160816; b=NBtoH6b6cp0rvRHrw1w5eWmq9BWfe7as8sXiypB9feUpFR73vHoGVG2oeHFqLkiryt v8/jAFaPc4aWfMseQbBN4X/ohfk9p1tj8Q2xJ6n3YrNMm2ho0fuHC5LgklMHWk1a4KHB hhzXI2AZ30lycso2UrXkIzvf9bIaQn7Dqs0PfkMATrLwB/r12uZvsOwNlhzcVgGgNk39 xP/keCm/P3peV80JotetXQ85uCRYmQgqbs6zK1P824l2XxImvBwPl4mj7yWtk3bkhiTx lus+YVAX9xXAA+kO/m6p5LugjHlWyu8FS4Dy9hycfwFQu6pOmZHaL2RHRTbn8YsubheM xdXQ== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=ywJjltyXgfa+FB6O+yfwkES0ZG9sSH6pKgr1D/SCQ58=; b=eN2hEMGhir3sXB1TdTNxk1pmpTamMQBAmTkBTeqJ+0e9WvZ4XreACRrnqAZd+MErEA eCt8wuBE3tgIs9IXOzjzheUM3WrF51e+ajNgVfiIOIGCJq/boz4HYWxWTzvyO3O0I6fY 0iXkQDD5ujWw47gJWNI30NlgSjAhk9+N7EnO+VEjxMNgfa15jUVxeM6ZwOzbsvR6owgt dCcCftmm5tClL0VJlSxgRZPdi9w+CZAFYrUaaVmQ4aY8XzoY0zz0c1hlNf9GCnEqAplI +Q+6b3Grn5TAQzuAXUGcP3gOKpGnSFXRdgLI2SRuqz9oAMqO+vi02nmEewe0NoMHUVdb mnkg== ARC-Authentication-Results: i=1; mx.google.com; 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 y17-20020a17090322d100b00192e2fde201si1495956plg.124.2023.01.15.13.59.50; Sun, 15 Jan 2023 13:59:57 -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; 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 S231572AbjAOVZQ (ORCPT + 52 others); Sun, 15 Jan 2023 16:25:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231482AbjAOVZO (ORCPT ); Sun, 15 Jan 2023 16:25:14 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F3A2144A4; Sun, 15 Jan 2023 13:25:12 -0800 (PST) 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 sin.source.kernel.org (Postfix) with ESMTPS id B45FBCE0C4C; Sun, 15 Jan 2023 21:25:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90613C433D2; Sun, 15 Jan 2023 21:25:07 +0000 (UTC) Date: Sun, 15 Jan 2023 16:25:04 -0500 From: Steven Rostedt To: "Joel Fernandes (Google)" Cc: linux-kernel@vger.kernel.org, Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , "Paul E. McKenney" , rcu@vger.kernel.org, fweisbec@gmail.com, urezki@gmail.com Subject: Re: [PATCH v2 rcu/dev 1/2] rcu: Track laziness during boot and suspend Message-ID: <20230115162504.08ef72b0@rorschach.local.home> In-Reply-To: <20230112005223.2329802-1-joel@joelfernandes.org> References: <20230112005223.2329802-1-joel@joelfernandes.org> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,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 Thu, 12 Jan 2023 00:52:22 +0000 "Joel Fernandes (Google)" wrote: > -- a/kernel/rcu/update.c > +++ b/kernel/rcu/update.c > @@ -144,8 +144,45 @@ bool rcu_gp_is_normal(void) > } > EXPORT_SYMBOL_GPL(rcu_gp_is_normal); > > -static atomic_t rcu_expedited_nesting = ATOMIC_INIT(1); > +static atomic_t rcu_async_hurry_nesting = ATOMIC_INIT(1); > +/* > + * Should call_rcu() callbacks be processed with urgency or are > + * they OK being executed with arbitrary delays? > + */ > +bool rcu_async_should_hurry(void) > +{ > + return !IS_ENABLED(CONFIG_RCU_LAZY) || > + atomic_read(&rcu_async_hurry_nesting); > +} > +EXPORT_SYMBOL_GPL(rcu_async_should_hurry); > + > +/** > + * rcu_async_hurry - Make future async RCU callbacks not lazy. > + * > + * After a call to this function, future calls to call_rcu() > + * will be processed in a timely fashion. > + */ > +void rcu_async_hurry(void) > +{ > + if (IS_ENABLED(CONFIG_RCU_LAZY)) > + atomic_inc(&rcu_async_hurry_nesting); > +} > +EXPORT_SYMBOL_GPL(rcu_async_hurry); > Where do you plan on calling these externally, as they are being marked exported? If you allow random drivers to enable this, I can see something enabling it and hitting an error path that causes it to never disable it. I wouldn't have EXPORT_SYMBOL_GPL() unless you really know that it is needed externally. In fact, is this really needed outside of the RCU subsystem? -- Steve > +/** > + * rcu_async_relax - Make future async RCU callbacks lazy. > + * > + * After a call to this function, future calls to call_rcu() > + * will be processed in a lazy fashion. > + */ > +void rcu_async_relax(void) > +{ > + if (IS_ENABLED(CONFIG_RCU_LAZY)) > + atomic_dec(&rcu_async_hurry_nesting); > +} > +EXPORT_SYMBOL_GPL(rcu_async_relax); > + > +static atomic_t rcu_expedited_nesting = ATOMIC_INIT(1);