Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1043487rdb; Wed, 6 Dec 2023 07:13:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IEXOJwhlQIvnHRID+z4RurhmeRfiFeejQCyxJdN3uE0RSAVn0Jhfmt71jQB8N1cdkJ5g3px X-Received: by 2002:a17:90a:1cd:b0:286:f3d8:de3f with SMTP id 13-20020a17090a01cd00b00286f3d8de3fmr720034pjd.84.1701875602973; Wed, 06 Dec 2023 07:13:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701875602; cv=none; d=google.com; s=arc-20160816; b=CIJUSEv1Bv70IX9tZL2veELEyBp71DyylVzA8Ak//lzO8KZFgOnexBCxPcJ2fza+56 io3Sy6cj6e7v1IUf8WcKrpqYV/XWoNJGL/5oNIjG8N0oYUjC6hTd6i1f4onTdwrLPPa9 vtb2H1EMBjPKYZ29B8Cx1vyANw75uEF7bccgFqlj/UL1i7W4HSVTUHvDaZDYi3LKjePJ B1x3lVhh07I8QONZIJh4aMWH49dg7FgMvXLVyX1/d65UZ7WEhX4Mve2g2sfTOXxIGH1h ox6ZbDGOBGLb0HiXjtUnums1X6LV6t5Xmd4s4LglQqHjPtXlXXYQcv3R9Jv1HHQ+yiPu 0sBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=DlA3J6KeiLPwS0f/3dubTvabmwmYjyMo2XWsrB4w408=; fh=dsjGSSeIOYbVRPjDgOs2+J/V5OwP3fzCoSxbrWjkLlA=; b=OCpxUUi8MrKs2x4zkG2g0I/KWqjLQK/B+qtbuNpTVJhR1+S6huLFrbjYL3IDIP4OrL HG2btHtXVivP9+J2fFu87l2gdWO2X+Fyx8ia1Gj4M/St7UheA38q5XdRe/9oD419c7va sY7BjscBJqQmN5/8xt0+gyNhCyxqgxLBnXgowFtlvXe5w4DRn6v2b4Y5xlqddI/uvOIa IJhGP3YD+lh76RFb02pOfPyoVP3mSFtfylJLna++AJGy0/cFZCMt8eU55VvlbgXLsxpT kX4ba74vsFKztquRiNWnYIaRNlCCGVHtC747mKH0nSf6yYwUWGs6AoIQauUtTBh6NZZH SvPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=nzFjv87J; dkim=neutral (no key) header.i=@linutronix.de header.b=s0GXFYFi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id bt3-20020a17090af00300b00286c0364964si1740117pjb.190.2023.12.06.07.13.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 07:13:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=nzFjv87J; dkim=neutral (no key) header.i=@linutronix.de header.b=s0GXFYFi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id CA3CE8078E3D; Wed, 6 Dec 2023 07:10:38 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442399AbjLFPKS (ORCPT + 99 others); Wed, 6 Dec 2023 10:10:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442456AbjLFPKP (ORCPT ); Wed, 6 Dec 2023 10:10:15 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B82E2D53 for ; Wed, 6 Dec 2023 07:10:21 -0800 (PST) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1701875419; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DlA3J6KeiLPwS0f/3dubTvabmwmYjyMo2XWsrB4w408=; b=nzFjv87JXZiNZNWNyj4RR/ie5cSZDXusw/aYYqYLsm/ikFiNJPWDmUnQQJnaxQ2uDJaS1A 2A5CqhGtwWTb0BOyCrG0yRmikNVa5Usbqz+EJktFDnFrJYgnCTQFh1aV5wf0wRNkHllni5 5RZ9pn9BKOyo5LpH6p5yFNGyE7h7docpauB4MBc9mRJZ6xxuoKK1qe3kRtVcvOLXdVA25+ 4l3m7wUW1RknCQH/GL5R9p+sLpdMaFI2WmL2ycBHpDenpdumnC5v3U2nO0qhhgjtpueFsm 0dbwJZ2Gmcn7/pOLp9N4KRjIQKrSIS3qzDQ97GHPDdKIjde0o4uX8RZYI1B5Kw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1701875419; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DlA3J6KeiLPwS0f/3dubTvabmwmYjyMo2XWsrB4w408=; b=s0GXFYFibOv7iKdtRRl6+1zP6sqdWCve1nXTradVU1o7nofS9PlGTCqL14MjhLUGqzJnnJ bR2fhq4jnrYTlNCg== To: paulmck@kernel.org 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 In-Reply-To: <209f0e89-7ebd-4759-9883-21d842d0d26c@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> <87v89lzu5a.ffs@tglx> <209f0e89-7ebd-4759-9883-21d842d0d26c@paulmck-laptop> Date: Wed, 06 Dec 2023 16:10:18 +0100 Message-ID: <875y1bwen9.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 howler.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 (howler.vger.email [0.0.0.0]); Wed, 06 Dec 2023 07:10:39 -0800 (PST) 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? >> 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. >> 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. :) 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. Thanks, tglx