Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp781804rdf; Tue, 21 Nov 2023 17:11:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IFNIYKPT8WQaLZ3h9sWuQcLY7vTDfudvMigQCkcmLjORPuhLqHMUe1QxccCvlTxLaUkCLBx X-Received: by 2002:a17:90b:4b8e:b0:27d:8d42:6def with SMTP id lr14-20020a17090b4b8e00b0027d8d426defmr892139pjb.34.1700615508929; Tue, 21 Nov 2023 17:11:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700615508; cv=none; d=google.com; s=arc-20160816; b=vxqNjCKTs9OcV5/VwZwQIVmhZjNWZSkYS/M6X856Y7OokjHdnKVvtcPkzAvLfks1LB uRXJadNS9NPxpsJkV4nH3VE+BlWYedMPfflNz/GNUVpVn7Uijqmm8Pw90ow+h+MuahRc GTFiUF0V8b3UZTeNpCcZqSkIq8mZqjTIWCUNJ8uSZ0HuLAWCPIlG3TfoLhJuNNKa0QpH E1j8DYh4WpnsKkxma7z5Qngc7laGSYT+Vd+6LLDRpUiCk4ROv6l0FF+CUQ247KWZknwG cmaPQyDXHK9MWcqNIJs4keaJYXgkjkWYlccsSOJnhtIbGPzrIx5kgsDL7xA9M0qHUiXO jEFA== 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=eg/lWZ5QTrQkA7SZqLx2eRWigw3oxuN4qYo73THjWE4=; fh=Yb2AMwVsQMt6QPw34oDb9/crS7Bw1aC677+PduyKroo=; b=VJtyo2p4mulZi3ObWI2oumO0NAHbGG2VFTdvnjswhqk0vjKIyALyZ00+rE7JSYjUjS /wIfczY47CCbOkfMBlCRViDvfZp1gp0HH8z8xLPJR6IC6R41VWhtqS96sB1euOX1Lx1C Fo/lHyfLPQ9g6sUcY6cndzOT4MAu06fQ75mTEw6608t/UjpjVsQ/uGcTO+/kcIg9rFId vyeokvSY4Nl1W4IdN7zBtYniwKSOtxocsXIkNZSqFYXIMz1Oy6g8ZCQCqMKZyR/Ueku1 iXMawjGM7HQ2QR8HAGNXRoCefV/+Db6llL1T/ASsXiSaXp7hMH6rYXpLDgkfL026gtIq p8KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dDLSkBmp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id om2-20020a17090b3a8200b002850f2ced2csi343846pjb.113.2023.11.21.17.11.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 17:11:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dDLSkBmp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id BD114806300F; Tue, 21 Nov 2023 17:10:26 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235020AbjKVBKH (ORCPT + 99 others); Tue, 21 Nov 2023 20:10:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235010AbjKVBJ6 (ORCPT ); Tue, 21 Nov 2023 20:09:58 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48948D5C for ; Tue, 21 Nov 2023 17:09:33 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C89FC433C7; Wed, 22 Nov 2023 01:09:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700615372; bh=qx4+zB74OcXNmjhoM86H8BT/pDj/mX4jQpnt9gfScjM=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=dDLSkBmpkz4uDUA4xFFvrcZUoTdP6LC7E7QVoaqUrUD5VhwNHjt/w9MEi/E1BGAu8 zYFmhq1OLFjUogIyk7RP7V3//peW3G/FohvZNuuCtJ8I62+ZLsb18WfthOzK67v4jt jARxSn90i78rkGWvsjEgWToNGaSNIdYtzZrkBP/oIwrF5PQuakLuaqFVvxS8QiASMN 8G082OsZrMXsIjZAyW9O3PPhx+XXTjqA1/jNcfffYWE1cSMuzytkYqBfE9Pa4/cQRy lo+QiC66wFKRAHGgwjZnDupaWbaiDYk+i45HT/Dtz1qrGBuEhlqLewBve7WVP5YnO6 g3EAqbJfZjoOw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 23A3FCE0ACF; Tue, 21 Nov 2023 17:09:32 -0800 (PST) Date: Tue, 21 Nov 2023 17:09:32 -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: Reply-To: paulmck@kernel.org References: <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> <20231121175209.1d7ec202@gandalf.local.home> <0d6a8e80-c89b-4ded-8de1-8c946874f787@paulmck-laptop> <20231121191232.630222d3@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231121191232.630222d3@gandalf.local.home> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Tue, 21 Nov 2023 17:10:26 -0800 (PST) On Tue, Nov 21, 2023 at 07:12:32PM -0500, Steven Rostedt wrote: > On Tue, 21 Nov 2023 16:01:24 -0800 > "Paul E. McKenney" wrote: > > > > > > I stand by that being in the else statement. It looks like that would keep > > > the previous work flow. > > > > Ah, because PREEMPT_NEED_RESCHED is zero when we need to reschedule, > > so that when __preempt_count_dec_and_test() returns false, we might > > still be in an RCU quiescent state in the case where there was no need > > to reschedule. Good point! > > > > In which case... > > > > #define preempt_enable() \ > > do { \ > > barrier(); \ > > if (unlikely(preempt_count_dec_and_test())) \ > > __preempt_schedule(); \ > > else if (!sched_feat(FORCE_PREEMPT) && \ > > (preempt_count() & (PREEMPT_MASK | SOFTIRQ_MASK | HARDIRQ_MASK | NMI_MASK) == PREEMPT_OFFSET) && \ > > !irqs_disabled()) \ > > ) \ > > rcu_all_qs(); \ > > } while (0) > > > > Keeping rcu_all_qs() pretty much as is. Or some or all of the "else if" > > condition could be pushed down into rcu_all_qs(), depending on whether > > Peter's objection was call-site object code size, execution path length, > > or both. ;-) > > > > If the objection is both call-site object code size and execution path > > length, then maybe all but the preempt_count() check should be pushed > > into rcu_all_qs(). > > > > Was that what you had in mind, or am I missing your point? > > Yes, that is what I had in mind. > > Should we also keep the !IS_ENABLED(CONFIG_PREEMPT_RCU) check, which makes > the entire thing optimized out when PREEMPT_RCU is enabled? I substituted the !sched_feat(FORCE_PREEMPT) for this because as I understand it, sites currently using CONFIG_PREEMPT_DYNAMIC=y (which is the default) and booting with preempt=none will currently have their grace periods helped by cond_resched(), so likely also need help, perhaps also from preempt_enable(). Thanx, Paul