Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp719683rdf; Tue, 21 Nov 2023 14:52:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IFwE1GLYCvuRN0u8dd84NDJ7H3Sj8BRjqj7xEfs47vGxlNoNyHxojhpiajOerWG/srqbl3G X-Received: by 2002:a05:6358:721:b0:168:f55d:4ef9 with SMTP id e33-20020a056358072100b00168f55d4ef9mr499223rwj.28.1700607150268; Tue, 21 Nov 2023 14:52:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700607150; cv=none; d=google.com; s=arc-20160816; b=zScl2n6OhVDPciOwftb7w9vD2esvADpPc3F2yRMkKpoKm33Q1QbcCIcjE8K6XmLubO OvQY4U8Wfy8wToO/LDFnFOWAniDDontmykGgNMTXEo/tY4wAA1UpB9wmeaVJrUNwvGRZ Ebteg836WLFpXJt6lVr9puzS2xWMHoPhvyF6IucpD+mBAvJqYl6ZM8QQBWT8Lml1y0Nh kajYFxPd2Gf7odM9941aM3fQYDmc+OB+voBtmTi4MKCQ3S1MQvQdi1Zj/urgGzoTlB/9 Hi3q4Yz9484u8xSV7XIho0rZmEdOUglB7Iz5kIPRNKBanO4Laj2EIFw2XwmAnR9nlKVg hWDg== 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=iNB+5XOZr3a3B6lMqiZCI2YyTYheSN+3jsAFYVitQaQ=; fh=vPkT0MUfeSf8F0qTSrwwLC/zJmpdXIshSKgYe92oSUk=; b=J0OtdmaviEaZwIm1aI9wrZkqu9HM2ktfNZtJXLS1I1gXtdXZlTLeEpxyTA6xnnnYG+ lbBJ9B8F991ryx0MGMZeOD1X8iE5U5d4CGl2ZGqNlTVhX96aMdvHjPDs3S1iwt3muaxN 15OJnTMso/HqgNq/vFVVj/CrtpspgeAkoXXgWjhpDX25xN0R+8Q+Ir3yJTl2YfwdYSR4 uYRCQn5kC13jDjqqM5bEh1wscaSjDb00L5Es16WnJ7d8CcJW9Gf94lLHTXy6aFQW+5lx TavBbR4QXaX33/tx4tgqG+nli+szrXjV+9ZRX2Bx6mrFPK5FUQ/Q8li2f2Kt6eYnDqJC g5pw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id n189-20020a6327c6000000b005c1c5d338a9si11911294pgn.658.2023.11.21.14.52.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 14:52:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 1ABF4806115C; Tue, 21 Nov 2023 14:52:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234701AbjKUWwE (ORCPT + 99 others); Tue, 21 Nov 2023 17:52:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229707AbjKUWwC (ORCPT ); Tue, 21 Nov 2023 17:52:02 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56EF4DD for ; Tue, 21 Nov 2023 14:51:59 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F5FAC433C8; Tue, 21 Nov 2023 22:51:55 +0000 (UTC) Date: Tue, 21 Nov 2023 17:52:09 -0500 From: Steven Rostedt To: "Paul E. McKenney" 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: <20231121175209.1d7ec202@gandalf.local.home> In-Reply-To: <4605b4f4-8a2b-4653-b684-9c696c36ebd0@paulmck-laptop> 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> <4605b4f4-8a2b-4653-b684-9c696c36ebd0@paulmck-laptop> X-Mailer: Claws Mail 3.19.1 (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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email 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 (fry.vger.email [0.0.0.0]); Tue, 21 Nov 2023 14:52:12 -0800 (PST) On Tue, 21 Nov 2023 14:26:33 -0800 "Paul E. McKenney" wrote: > 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? preempt_count_dec_and_test() returns true if preempt_count() is zero, which happens only if NEED_RESCHED is set, and the rest of preempt_count() is not set. (NEED_RESCHED bit in preempt_count() is really the inverse of NEED_RESCHED). Do we need to call rcu_all_qs() when we call the scheduler? Isn't scheduling a quiescent state for most RCU flavors? I thought this was to help move along the quiescent states without added cond_resched() around, which has: int __sched __cond_resched(void) { if (should_resched(0)) { preempt_schedule_common(); return 1; } /* * In preemptible kernels, ->rcu_read_lock_nesting tells the tick * whether the current CPU is in an RCU read-side critical section, * so the tick can report quiescent states even for CPUs looping * in kernel context. In contrast, in non-preemptible kernels, * RCU readers leave no in-memory hints, which means that CPU-bound * processes executing in kernel context might never report an * RCU quiescent state. Therefore, the following code causes * cond_resched() to report a quiescent state, but only when RCU * is in urgent need of one. */ #ifndef CONFIG_PREEMPT_RCU rcu_all_qs(); #endif return 0; } Where if we schedule, we don't call rcu_all_qs(). I stand by that being in the else statement. It looks like that would keep the previous work flow. -- Steve