Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C44C7C678DB for ; Sun, 5 Mar 2023 23:00:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229906AbjCEXAf (ORCPT ); Sun, 5 Mar 2023 18:00:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229848AbjCEXAd (ORCPT ); Sun, 5 Mar 2023 18:00:33 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE315EB42; Sun, 5 Mar 2023 15:00:28 -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 21ECF608C3; Sun, 5 Mar 2023 23:00:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE67BC433EF; Sun, 5 Mar 2023 23:00:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678057227; bh=KX5vG0mpxDOUHdWtTgFggazVzcZwGLcxK6WC4JTqY/g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ovOT4rSB0wIMIGK19NIt88LnlF4L2vpURTGZcyTImbSmOrlDTKfgVRV85Zdfo/Gum SspASA05lnJSj1fmD2FB/3FNrAFOi7k07OksNp/RQ1cDwTtLT/AUa4yrrkUKMaABfc o27zDToH+8LwKpfRdG1EEo4tRfpQBH311b55iVTn/AcTS9MsXtSD9nc3hhA9T/DGBM ttEt9odlP5EosGSabdETNvHoGlHSVgz5DhQS1bqjBpFvha3HZJXroxYvz/qgN+AkxM MbQyAeLosOp7vp18R6C/xV7nOQNuqluHYAIwULT9PrPcwPxahbiNCDlR8BjKgNwT7D 5V7ftQcILO6nA== Date: Mon, 6 Mar 2023 00:00:24 +0100 From: Frederic Weisbecker To: "Paul E. McKenney" Cc: Thomas Gleixner , Jakub Kicinski , peterz@infradead.org, jstultz@google.com, edumazet@google.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] softirq: avoid spurious stalls due to need_resched() Message-ID: References: <20230303133143.7b35433f@kernel.org> <87r0u3hqtw.ffs@tglx> <20230305224211.GN1301832@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230305224211.GN1301832@paulmck-ThinkPad-P17-Gen-1> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 05, 2023 at 02:42:11PM -0800, Paul E. McKenney wrote: > On Sun, Mar 05, 2023 at 09:43:23PM +0100, Thomas Gleixner wrote: > Indeed, as you well know, CONFIG_RCU_NOCB_CPU=y in combination with the > rcutree.use_softirq kernel boot parameter in combination with either the > nohz_full or rcu_nocbs kernel boot parameter and then the callbacks are > invoked within separate kthreads so that the scheduler has full control. > In addition, this dispenses with all of the heuristics that are otherwise > necessary to avoid invoking too many callbacks in one shot. > > Back in the day, I tried making this the default (with an eye towards > making it the sole callback-execution scheme), but this resulted in > some ugly performance regressions. This was in part due to the extra > synchronization required to queue a callback and in part due to the > higher average cost of a wakeup compared to a raise_softirq(). > > So I changed to the current non-default arrangement. > > And of course, you can do it halfway by booting kernel built with > CONFIG_RCU_NOCB_CPU=n with the rcutree.use_softirq kernel boot parameter. > But then the callback-invocation-limit heuristics are still used, but > this time to prevent callback invocation from preventing the CPU from > reporting quiescent states. But if this was the only case, simpler > heuristics would suffice. > > In short, it is not hard to make RCU avoid using softirq, but doing so > is not without side effects. ;-) Right but note that, threaded or not, callbacks invocation happen within a local_bh_disable() section, preventing other softirqs from running. So this is still subject to the softirq per-CPU BKL.