From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D746C433DB for ; Mon, 8 Feb 2021 14:55:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AA15364E3F for ; Mon, 8 Feb 2021 14:55:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232690AbhBHOz2 (ORCPT ); Mon, 8 Feb 2021 09:55:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:49626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233050AbhBHOxv (ORCPT ); Mon, 8 Feb 2021 09:53:51 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id DBFC264E0B; Mon, 8 Feb 2021 14:53:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612795991; bh=i6f/6e4GcjdYXiSC4q7RU5ecXO577LdJe4fGuhC3+7Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=e0LPizB5rUAklGv6vltYdeXCuWd1OqWVWjcnZULW3E6Bfdx5PTLCfBINp7fXa/If5 2206YM+eT6ivp5xKk/nV0G5YyLvyxnvbIG+Vz7HKx88C1MFiGuAAwaJJPmyySISN4R zkh/xMIaBK6LLleVzXn18SS28WprDFQo22i9Qkiyt20RbxQ8cjYGKrQhZXC/wxlGzA DErIjyXcrlUooaSBv5QdezXlsF+yMtpEkzxw71nNEGCEpbB0y4z4Q9dIdVkwDTjnsf bFobyW0wp9t7ujyVRsL/jH3mbuMvwRuKPkiQCgU2Me8v048BLAWIEzBoyDLDaZyHGs TT0vA5QAsyFiQ== Date: Mon, 8 Feb 2021 15:53:08 +0100 From: Frederic Weisbecker To: Peter Zijlstra Cc: "Paul E . McKenney" , LKML , Paolo Bonzini , "Rafael J . Wysocki" , Thomas Gleixner , stable@vger.kernel.org, Ingo Molnar Subject: Re: [PATCH 2/5] rcu/nocb: Perform deferred wake up before last idle's need_resched() check Message-ID: <20210208145308.GC3969@lothringen> References: <20210131230548.32970-1-frederic@kernel.org> <20210131230548.32970-3-frederic@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 08, 2021 at 03:45:50PM +0100, Peter Zijlstra wrote: > On Mon, Feb 01, 2021 at 12:05:45AM +0100, Frederic Weisbecker wrote: > > > diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c > > index 305727ea0677..b601a3aa2152 100644 > > --- a/kernel/sched/idle.c > > +++ b/kernel/sched/idle.c > > @@ -55,6 +55,7 @@ __setup("hlt", cpu_idle_nopoll_setup); > > static noinline int __cpuidle cpu_idle_poll(void) > > { > > trace_cpu_idle(0, smp_processor_id()); > > + rcu_nocb_flush_deferred_wakeup(); > > stop_critical_timings(); > > rcu_idle_enter(); > > local_irq_enable(); > > @@ -173,6 +174,8 @@ static void cpuidle_idle_call(void) > > struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev); > > int next_state, entered_state; > > > > + rcu_nocb_flush_deferred_wakeup(); > > + > > /* > > * Check if the idle task must be rescheduled. If it is the > > * case, exit the function after re-enabling the local irq. > > Ok if I do this instead? > > --- a/kernel/sched/idle.c > +++ b/kernel/sched/idle.c > @@ -55,7 +55,6 @@ __setup("hlt", cpu_idle_nopoll_setup); > static noinline int __cpuidle cpu_idle_poll(void) > { > trace_cpu_idle(0, smp_processor_id()); > - rcu_nocb_flush_deferred_wakeup(); > stop_critical_timings(); > rcu_idle_enter(); > local_irq_enable(); > @@ -174,8 +173,6 @@ static void cpuidle_idle_call(void) > struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev); > int next_state, entered_state; > > - rcu_nocb_flush_deferred_wakeup(); > - > /* > * Check if the idle task must be rescheduled. If it is the > * case, exit the function after re-enabling the local irq. > @@ -288,6 +285,7 @@ static void do_idle(void) > } > > arch_cpu_idle_enter(); > + rcu_nocb_flush_deferred_wakeup(); > > /* > * In poll mode we reenable interrupts and spin. Also if we Right, I think that should work. Nothing should call_rcu() before the need_resched() call. And if it does, we still have the nocb_timer to do the deferred wakeup in the worst case. Thanks.