Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1419808rdb; Wed, 6 Dec 2023 20:17:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IE7YQ54kOdvrtCN4IYGtjqRJoCuV3NnFgs7/o/1+d3y9jZT7mIHi6FZFePUedKLZ5SqYDtj X-Received: by 2002:a17:903:110d:b0:1d0:8f61:f67a with SMTP id n13-20020a170903110d00b001d08f61f67amr1749419plh.101.1701922659539; Wed, 06 Dec 2023 20:17:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701922659; cv=none; d=google.com; s=arc-20160816; b=cuFkoI6VG//0GzDRDhhGqXjgKKaNAvGBjm5fXmbFRN1eZhwH07sItZw5dMCeXGxNAY 56KGgHFziznH3uXASH8lzLgDAwSwbca7DgFDRlxUMgYAzML+9cTySFpE3q2ZhlFISvue KV/62+exBxfN+CRfQAWaTAyuRu8H8uL2uCBbUtCtIfHlCWIf5Qr0IzeAz/JksffP6NkB aWWHw5PVDSxN5l7rTGNqAFPICXPd1p+2XPTSUW4/8bzf2xYtMV+SqzCHh6/kziKqCxBa Vxjpm5VQIRBQFOXJlGWe2KBWoGR2oeOwZQmFAMjj15FSaCsHNRF9Qnv+nyfFE4TLB+rK dQeg== 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=wO4oUG+QC78rAEYOJfFdwwCXUa5IcAsEb7T1sKZHqtU=; fh=xNhAMURLtq+0CSV7KUe7jgsJMf7oCQnjnIN8tSVsMlM=; b=cYoql4+61pAkxvCL8YjI/TZRWVpXHCo9q6+QIVAzVhPzmfusaI2Xv6SMTwjT2FlPH/ DMfyqLECerlt8AsGTqheglYXH9cC9Xl2Uj2Ca7nf+/5n1BfljPgNubFaDpYho9NwbmLf UQLMTYUIbBJRQsWm0sNLux7gfbM7rD+ge9nEmJnc7CbwenTj060B3i3p7tr0hJ+F31DA itdrI4FTArk0R6DMNlSNQlElnMyoYN0OUxbTrk53JC2H4mpZZ6Fd+3pl8WBzqKOVDQJy FDL3H/j98TMo7kM6gN7z99Pm5q2xNwMJo07MnqrWgjmlKAcBazZNrPgrDYyDPyNt56sl a4AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jURRJuZ9; 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 b13-20020a170902ed0d00b001d00594c6e6si409794pld.106.2023.12.06.20.17.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 20:17:39 -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=jURRJuZ9; 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 B65448145941; Wed, 6 Dec 2023 20:17:36 -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 S229616AbjLGERX (ORCPT + 99 others); Wed, 6 Dec 2023 23:17:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229449AbjLGERW (ORCPT ); Wed, 6 Dec 2023 23:17:22 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA862DD for ; Wed, 6 Dec 2023 20:17:27 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CB3DC433C7; Thu, 7 Dec 2023 04:17:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701922647; bh=T+v7xQvdCpJ6DcfwiigwsZNAAWWbz1JSdHy4eCuWWWw=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=jURRJuZ9+VEQSNiJ/mGla8BQv99HITnl1MpanDWFC2m9APywmIaCm1VQb5IBXnci7 OUPfxAad85Y4t0bnci3B4FgmTeCGmMFBnMYAvDQZfuYDW38Tcgd+QjJTLik9bBPBzJ HsP1fK/y3SLK7zzyi/47+cmMVusOngCr5ILZ6MPSyvYWLtW4OYk3mJdv2jE5wk2Lp+ jOudlCHnHXKjAFTN0qjFOA8d7czNjckrmNrOCTXg2qd0Jeo2L3Xy1SXJljfFPioNWQ tx7r5rq/RFBJVNAry21GXxX7LNfYZMMCRLs4+fFflB+EpSXrAIPFabnDn1pfVF6OdN 4fh4qiHcD3bUA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id D7EBFCE0E88; Wed, 6 Dec 2023 20:17:26 -0800 (PST) Date: Wed, 6 Dec 2023 20:17:26 -0800 From: "Paul E. McKenney" To: Thomas Gleixner Cc: Ankur Arora , linux-kernel@vger.kernel.org, peterz@infradead.org, 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, rostedt@goodmis.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: <20231107215742.363031-1-ankur.a.arora@oracle.com> <20231107215742.363031-49-ankur.a.arora@oracle.com> <2027da00-273d-41cf-b9e7-460776181083@paulmck-laptop> <87v89lzu5a.ffs@tglx> <209f0e89-7ebd-4759-9883-21d842d0d26c@paulmck-laptop> <875y1bwen9.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <875y1bwen9.ffs@tglx> 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]); Wed, 06 Dec 2023 20:17:37 -0800 (PST) On Wed, Dec 06, 2023 at 04:10:18PM +0100, Thomas Gleixner wrote: > Paul! > > On Mon, Dec 04 2023 at 17:33, Paul E. McKenney wrote: > > On Tue, Nov 28, 2023 at 06:04:33PM +0100, Thomas Gleixner wrote: > >> So: > >> > >> loop() > >> > >> preempt_disable(); > >> > >> --> tick interrupt > >> rcu_flavor_sched_clock_irq() > >> sets NEED_RESCHED > >> > >> preempt_enable() > >> preempt_schedule() > >> schedule() > >> report_QS() > >> > >> See? No magic nonsense in preempt_enable(), no cond_resched(), nothing. > > > > Understood, but that does delay detection of that quiescent state by up > > to one tick. > > Sure, but does that really matter in practice? It might, but yes, I would expect it to matter far less than the other things I have been calling out. > >> So if that turns out to matter in reality and not just by academic > >> inspection, then we are far better off to annotate such code with: > >> > >> do { > >> preempt_lazy_disable(); > >> mutex_lock(); > >> do_stuff(); > >> mutex_unlock(); > >> preempt_lazy_enable(); > >> } > >> > >> and let preempt_lazy_enable() evaluate the NEED_RESCHED_LAZY bit. > > > > I am not exactly sure what semantics you are proposing with this pairing > > as opposed to "this would be a good time to preempt in response to the > > pending lazy request". But I do agree that something like this could > > replace at least a few more instance of cond_resched(), so that is good. > > Not necessarily all of them, though. > > The main semantic difference is that such a mechanism is properly > nesting and can be eventually subsumed into the actual locking > constructs. OK, fair enough. And noting that testing should include workloads that exercise things like mutex_lock() and mutex_trylock() fastpaths. > >> Just insisting that RCU_PREEMPT=n requires cond_resched() and whatsoever > >> is not really getting us anywhere. > > > > Except that this is not what is happening, Thomas. ;-) > > > > You are asserting that all of the cond_resched() calls can safely be > > eliminated. That might well be, but more than assertion is required. > > You have come up with some good ways of getting rid of some classes of > > them, which is a very good and very welcome thing. But that is not the > > same as having proved that all of them may be safely removed. > > Neither have you proven that any of them will be required with the new > PREEMPT_LAZY model. :) True. But nor have you proven them unnecessary. That will need to wait for larger-scale testing. > Your experience and knowledge in this area is certainly appreciated, but > under the changed semantics of LAZY it's debatable whether observations > and assumptions which are based on PREEMPT_NONE behaviour still apply. > > We'll see. That we will! Thanx, Paul