Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp710604rdf; Tue, 21 Nov 2023 14:28:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IHx6GjDmw7oTjB3G1zEHTCqFoQ1QynS1LbLHD7HkkMWP1fw5wPj+xBq8aI3EmVyU1ZdtoFg X-Received: by 2002:a05:6a00:21c4:b0:6cb:4d36:5d07 with SMTP id t4-20020a056a0021c400b006cb4d365d07mr665502pfj.10.1700605733385; Tue, 21 Nov 2023 14:28:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700605733; cv=none; d=google.com; s=arc-20160816; b=EuHvvjGhXmGQ2z41Japbrp/XN6i728pp2lPD8XJjTmJijBXRUEAfzyb/A9Yv5LZtXF DCc2wqxWRkiIgxY72ZR1e2nbyTRBCv+ZFqVlZ4lAmI8jvccKAmc/XMOY1lezilT5u8H7 qsF+Yjk9Ru3qtmGIBskoROqEmTpCMSalDXLF9cMNXjXO1okzroBDX+gBhgvM7djcuXkV fZhSclA7idZEnPRFHbz+/ZJbdAORil6fOiz14hMPLY8bmU5WBUh0CAELd6nQbZ5xfh4w V9CZDRwIzmwJh1vUB9Y6FlQrqolOSgcbE1/1Kt3k1mOxmpsTf5uUygp1lae5Cvlotf7x YZHw== 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=7TFHxj8Zcme8QvZAjCZF1MoHV884vaZtlBYZAOZw+Dc=; fh=Yb2AMwVsQMt6QPw34oDb9/crS7Bw1aC677+PduyKroo=; b=UvB5gxzkIf6CyRSm6Nvs7N+6tEDVwpFJQgx+2WzKdNmMQJIYCgcxYiYYhdZVHZwwkj 7y5Wlx7rlKPiqAHKScI/kcCaX8hLiqMAsAz3fX7FNUp4W9+qW9zwBIiGf4XLAPF8OqCw gVy0raQ2XuDldNiZZKEY9wA40b4EBZUcZ4GhwV2zgwJcihGF0LvcBws6ErshdrVFITXM rgwGN8Ry63pW7v45wEP0B8WGCRFpKNvNh4RL4NZ7AUVqPcaj5sfWLX9TnhG73Kf+orp8 YaiJKo9JNdDS1mfi1+tC++ZoX/ij6wW38mF5NOx+sYGkQeL7cen7dOQOJgr31R3CfCtw JDeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=C1XFxvqU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id cm11-20020a056a020a0b00b005b92d40e11bsi12380918pgb.168.2023.11.21.14.28.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 14:28:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=C1XFxvqU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 743138031B3C; Tue, 21 Nov 2023 14:26:48 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234494AbjKUW0k (ORCPT + 99 others); Tue, 21 Nov 2023 17:26:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233840AbjKUW0i (ORCPT ); Tue, 21 Nov 2023 17:26:38 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A469719E for ; Tue, 21 Nov 2023 14:26:34 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41244C433C8; Tue, 21 Nov 2023 22:26:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700605594; bh=FPPt5tUzEZ3u3b0Jn2C7V097kPxP7PC2yCECE/pLi8s=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=C1XFxvqURFiwuXNBaj4WAHtdDfR/f+c6b8VbzSMgMK/kkHG0C5iCocQXshA8LPBgB dLyQYC/IPlgtArFw6Ic1QOMCfybHii0KX1LXH5VoKL/a/vJW+uKHPLnThP6Dul3iZt KAaNyRN/jO5yMK9mZvgihyuT9u6jHYc704Jihr4mSnBYvMdCr6B6qPVvt4yiDuJy2F R2z+5r3NBdT93C7htb8QVBB+Iiamp9bfWirB1EnOteiLGN/uvp6r5V1xSLjF99P4WG LFcmgTDCjMgdbEnn5FzYL51qpnPv8N+viveehMZBkcszZgPUVN4TWgtcdQC+XF/EEm ekMM5yPuMsJqw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id C9412CE078E; Tue, 21 Nov 2023 14:26:33 -0800 (PST) Date: Tue, 21 Nov 2023 14:26:33 -0800 From: "Paul E. McKenney" To: Steven Rostedt Cc: Peter Zijlstra , Ankur Arora , linux-kernel@vger.kernel.org, tglx@linutronix.de, torvalds@linux-foundation.org, linux-mm@kvack.org, x86@kernel.org, akpm@linux-foundation.org, luto@kernel.org, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, willy@infradead.org, mgorman@suse.de, jon.grimm@amd.com, bharata@amd.com, raghavendra.kt@amd.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com, jgross@suse.com, andrew.cooper3@citrix.com, mingo@kernel.org, bristot@kernel.org, mathieu.desnoyers@efficios.com, geert@linux-m68k.org, glaubitz@physik.fu-berlin.de, anton.ivanov@cambridgegreys.com, mattst88@gmail.com, krypton@ulrich-teichert.org, David.Laight@aculab.com, richard@nod.at, mjguzik@gmail.com Subject: Re: [RFC PATCH 48/86] rcu: handle quiescent states for PREEMPT_RCU=n Message-ID: <4605b4f4-8a2b-4653-b684-9c696c36ebd0@paulmck-laptop> Reply-To: paulmck@kernel.org References: <20231107215742.363031-1-ankur.a.arora@oracle.com> <20231107215742.363031-49-ankur.a.arora@oracle.com> <2027da00-273d-41cf-b9e7-460776181083@paulmck-laptop> <87lear4wj6.fsf@oracle.com> <46a4c47a-ba1c-4776-a6f8-6c2146cbdd0d@paulmck-laptop> <31d50051-e42c-4ef2-a1ac-e45370c3752e@paulmck-laptop> <20231121203049.GN8262@noisy.programming.kicks-ass.net> <1cdbb0f6-9078-4023-bf37-8d826ca0c711@paulmck-laptop> <20231121163834.571abb52@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231121163834.571abb52@gandalf.local.home> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 21 Nov 2023 14:26:48 -0800 (PST) On Tue, Nov 21, 2023 at 04:38:34PM -0500, Steven Rostedt wrote: > On Tue, 21 Nov 2023 13:14:16 -0800 > "Paul E. McKenney" wrote: > > > On Tue, Nov 21, 2023 at 09:30:49PM +0100, Peter Zijlstra wrote: > > > On Tue, Nov 21, 2023 at 11:25:18AM -0800, Paul E. McKenney wrote: > > > > #define preempt_enable() \ > > > > do { \ > > > > barrier(); \ > > > > if (!IS_ENABLED(CONFIG_PREEMPT_RCU) && raw_cpu_read(rcu_data.rcu_urgent_qs) && \ > > > > (preempt_count() & (PREEMPT_MASK | SOFTIRQ_MASK | HARDIRQ_MASK | NMI_MASK) == PREEMPT_OFFSET) && > > > > !irqs_disabled()) \ > > Could we make the above an else case of the below if ? Wouldn't that cause the above preempt_count() test to always fail? Another approach is to bury the test in preempt_count_dec_and_test(), but I suspect that this would not make Peter any more happy than my earlier suggestion. ;-) > > > > rcu_all_qs(); \ > > > > if (unlikely(preempt_count_dec_and_test())) { \ > > > > __preempt_schedule(); \ > > > > } \ > > > > } while (0) > > > > > > Aaaaahhh, please no. We spend so much time reducing preempt_enable() to > > > the minimal thing it is today, this will make it blow up into something > > > giant again. > > Note, the above is only true with "CONFIG_PREEMPT_RCU is not set", which > keeps the preempt_count() for preemptable kernels with PREEMPT_RCU still minimal. Agreed, and there is probably some workload that does not like this. After all, current CONFIG_PREEMPT_DYNAMIC=y booted with preempt=none would have those cond_resched() invocations. I was leary of checking dynamic information, but maybe sched_feat() is faster than I am thinking? (It should be with the static_branch, but not sure about the other two access modes.) Thanx, Paul