Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7000376rwl; Mon, 9 Jan 2023 16:26:12 -0800 (PST) X-Google-Smtp-Source: AMrXdXud379W8zwmjINFBoSUcXMOvIgK0WBRSHUNEUDdMmwtpHchLxhtjonerTlTZHU/YKzmBiQr X-Received: by 2002:a17:906:398f:b0:7fd:ec83:b8b9 with SMTP id h15-20020a170906398f00b007fdec83b8b9mr54768660eje.44.1673310372452; Mon, 09 Jan 2023 16:26:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673310372; cv=none; d=google.com; s=arc-20160816; b=CZAZMkY13S1k737wfRn3uePx6aaIjDP94hzHNBkj9gw1e1aJ3kOBzwqzXo4WiuB6aW xkFu5D4o2QxMVYw48IhIBNi306nnzhVkha6qVGhsH347YVBoYjVI4AFfUmLzIPWCw+vV OmHo0Slbawm/i2Cx2Ur9Ha8nrHpdLFTYDSyrWmbux2Vm3rwbgAwxd4ju8KpLrloEEwTS 9glVxAuBJM5jy+EB+OT7U4Q3NN5PAkHoRRlMqFgxo7p90KcgcOTSlRpcVrUsYGCqBkDA yEiCN+jAELEF/U4fuNIpx8Ph0EvV3liAwpzi4NzqfBxvFkam2G3QBVqdkpxb4LDgEYP0 z6zg== 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-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=FN0+ezqmkYsF++6nbEaBIORYPtdMR4qKF5sUcIz5LpE=; b=RoM8EtNr8p1uX2L6Lv7GNzEekxLjyjR92uqF/JBqj2T51+WNOrzZvjKNaN6ZFzq2kR iZlzxBF3OodrVkx54WoI0xLcu8C8r32KoHYJ0Nkbr+yeRKuE4XXrfBaEr/idVpuFhG1x 1O6u6oRD1cMQqWuP/kcKDiTsBWrLaicaJ/fQVaAGr4ybehuEHkRBBxcTo8pr58vR28v+ LrcMnnLewa08ZyX7el5VIqmACqz/WOqU22Dilj8+RCeswYJ1PcHT/18dvtpXB26LmEpY VYYIwVWp3uGIqjMJyjZ8aRmi5iI0JCVYNZIWF9iPlhZNYmVbwrHBB/YycebglwY8fYu4 82KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WgQ7RYme; 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 oz40-20020a1709077da800b0084d13c118absi10927881ejc.507.2023.01.09.16.25.59; Mon, 09 Jan 2023 16:26:12 -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=@kernel.org header.s=k20201202 header.b=WgQ7RYme; 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 S237523AbjAIXOW (ORCPT + 53 others); Mon, 9 Jan 2023 18:14:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234627AbjAIXOS (ORCPT ); Mon, 9 Jan 2023 18:14:18 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D67BE3BE81; Mon, 9 Jan 2023 15:14:17 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 6BF8961471; Mon, 9 Jan 2023 23:14:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9458CC433D2; Mon, 9 Jan 2023 23:14:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673306056; bh=CjrypHLmoNnt1ElYwzhHOe0piX1D547BMjLmD95cSX0=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=WgQ7RYmeKWFxNsOy8Uvv8vLjVhZ1nDJnZqvEs2klECRfoSCi+zGrq5nWbXQiVJFZB f1G4SW3KWArmhIjJEcmnmXkMdAGkiXI8vW2vhVASW/84RCk0LaMtg7qelqJgWfTe3C IqOPuN0Eo28Gv8DcndcCQ38n7qTrxfspyay3Je3MS9CcYmmDf5gw9gRo3HLxULqaRB JkDyuZGiX+uNqz1C6lMXKkJBXLCKHlTg3Q1VPoqaQV6P4uN5Ds8NlPeD/ja5Rt0Gu0 ycU0r8WRM6jTiYJoNKjzLyXID7yWBFmA3oXMC63qDReVP93wfEnzkD0DRQA6Rr44us Ld/TXryjcgyIQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 376815C05C5; Mon, 9 Jan 2023 15:14:16 -0800 (PST) Date: Mon, 9 Jan 2023 15:14:16 -0800 From: "Paul E. McKenney" To: "Joel Fernandes (Google)" Cc: linux-kernel@vger.kernel.org, Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , rcu@vger.kernel.org, Steven Rostedt , foo@bar.com Subject: Re: [PATCH -rcu] rcu: Disable lazy if call_rcu() called when GPs expedited Message-ID: <20230109231416.GA4028633@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20230109221756.1361168-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230109221756.1361168-1-joel@joelfernandes.org> X-Spam-Status: No, score=-7.1 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 Mon, Jan 09, 2023 at 10:17:56PM +0000, Joel Fernandes (Google) wrote: > During suspend, we see failures to suspend 1 in 300-500 suspends. > Looking closer, it appears that we are queuing lazy callbacks even > though rcu_gp_is_expedited(). These delays appear to not be very welcome > by the suspend/resume code as evidenced by these occasional suspend > failures. > > This commit therefore checks if rcu_gp_is_expedited() and ignores the > lazy hint if so. > > Ignoring the lazy hint if rcu_gp_is_expedited() makes the 3000 > suspend/resume cycles pass reliably on a 12th gen 12-core Intel CPU. Yow!!! ;-) > Fixes: 3cb278e73be5 ("rcu: Make call_rcu() lazy to save power") > Signed-off-by: Joel Fernandes (Google) > --- > Paul, could we take this for 6.2 -rc cycle? Thanks. > > kernel/rcu/tree.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c > index 63545d79da51..93eb03f8ed99 100644 > --- a/kernel/rcu/tree.c > +++ b/kernel/rcu/tree.c > @@ -2594,12 +2594,12 @@ static void check_cb_ovld(struct rcu_data *rdp) > } > > static void > -__call_rcu_common(struct rcu_head *head, rcu_callback_t func, bool lazy) > +__call_rcu_common(struct rcu_head *head, rcu_callback_t func, bool lazy_in) > { > static atomic_t doublefrees; > unsigned long flags; > struct rcu_data *rdp; > - bool was_alldone; > + bool was_alldone, lazy; Please put "lazy" in alpha order. Except that... > /* Misaligned rcu_head! */ > WARN_ON_ONCE((unsigned long)head & (sizeof(void *) - 1)); > @@ -2622,6 +2622,7 @@ __call_rcu_common(struct rcu_head *head, rcu_callback_t func, bool lazy) > kasan_record_aux_stack_noalloc(head); > local_irq_save(flags); > rdp = this_cpu_ptr(&rcu_data); > + lazy = lazy_in && !rcu_gp_is_expedited(); Doesn't this completely disable laziness on Android? Thanx, Paul > /* Add the callback to our list. */ > if (unlikely(!rcu_segcblist_is_enabled(&rdp->cblist))) { > -- > 2.39.0.314.g84b9a713c41-goog