Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3971518rdg; Wed, 18 Oct 2023 10:56:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFsxuQvkyfrq5+KYTwYLrnu9zjFYLCqREtUVGde6FIhok8dFVUXqFgV6OGL3UbEEXzRLRxo X-Received: by 2002:a05:6a21:788d:b0:15e:b8a1:57b0 with SMTP id bf13-20020a056a21788d00b0015eb8a157b0mr6155108pzc.39.1697651795499; Wed, 18 Oct 2023 10:56:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697651795; cv=none; d=google.com; s=arc-20160816; b=0rfl4fzHe4mAuHd5OKktq2VpqfUDuzYflEdGh7Dqh9w6x3UrYcDJet4+O0q4TkMdy4 Q2bXLoP/mW5DD1iYxPAkEOiIgpzFfx5ZnajiftyElkuyo/7iMXtuVXyi8nXoqM0u4zn1 VoD5nUQ4Mnmpyl96Auh9SHDC0/uV1Qz1c7m3PElBPcCy+SX7pIxHeCdk4FF1CHx4nimm osLBMtenx1tjFZzL+v7cr5SsSWOmnDDCC0vhsx8udDilOdrJzepl+62CkwGWIehETf9y DL9Lky8LhAcB/N6bM0irP0kMHv+kJWO7haeYkSMXCuSAnuNzF/u27QhRTIh8p0UserMx sn9w== 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=K9Lj9OYcnZjZhHlu9ykbpZjxDBTCHO21NWDeOCtijF0=; fh=79cutc6+adEf3DakPqR3An/cJK2bgOHoXXpd8XMfeOE=; b=aHu1DBpLLepsjpGx668/ZNjzi5JmZHq+IWSy7nULa1gzRIppYoYeyC7PpkeTY4uXKC 0SHoH45vcYI0yjc3mmbC9pDCyfmgqwj8NWSwK04CJ3+fi81Rd7mCczakcJgYwW0u7RnJ fd/BdOikPjt+bm6W2yCkZ1diXbSlVdoYKDcrRJwz/8b2CYvib1xkrOSunB4MwEHQlXbl lnaYEuX7q0ezC8rt7v5zkSSL29iTTfCp1RnEtgVMlEeCkziWP03mFOG8jyf8SXY42JdF L4wvMFKDFo29R74Xn1NarkQeOryU1of1xcL7h883WbhO2MYR+S1sAI/WqZDtV109+JFN e/vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=B8PKYxWI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id k9-20020a170902694900b001c20db25108si344402plt.41.2023.10.18.10.56.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 10:56:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=B8PKYxWI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 1F0958083ADE; Wed, 18 Oct 2023 10:55:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231864AbjJRRzL (ORCPT + 99 others); Wed, 18 Oct 2023 13:55:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231822AbjJRRzF (ORCPT ); Wed, 18 Oct 2023 13:55:05 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D10F7111 for ; Wed, 18 Oct 2023 10:55:03 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BFEAC433C8; Wed, 18 Oct 2023 17:55:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697651703; bh=y11GmPUioTTsJkproZ9v5w2ZavV7U/e6HoyPkjTkXGk=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=B8PKYxWIDVi5wbmumEgOqxlemNvx24AxrJawiyQh8vo/kTyoTZjcxq+QytyeGp308 zuoFkJpP2fYEgYvzRWTtxs/u1NQ2v/99hn22L9rl4P4eIfHmoufDrqVSD7bMfszSiR iMV2bFKwOFcA4y53W3ETa6jbMlbOje+kM0GHPdYpxyRwQDCMCvHQAf/nxEXPz86gPw TAMmVpRPY+wcbJm162nkhdtToKT9d79hlAp+Co4wQjDnPNbVzWByrXree/Nuey5IZV 86GIuLPc6IvXX78hQHg//+dwLNR775j4GGS/6v/7PCmwQxgEvJ/w4FsnUdVzC1X/s8 dfAB0aF5DQWTw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id F26CECE0DE3; Wed, 18 Oct 2023 10:55:02 -0700 (PDT) Date: Wed, 18 Oct 2023 10:55:02 -0700 From: "Paul E. McKenney" To: Steven Rostedt Cc: Thomas Gleixner , Linus Torvalds , Peter Zijlstra , Ankur Arora , linux-kernel@vger.kernel.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, Frederic Weisbecker , Daniel Bristot de Oliveira Subject: Re: [PATCH v2 7/9] sched: define TIF_ALLOW_RESCHED Message-ID: Reply-To: paulmck@kernel.org References: <87ttrngmq0.ffs@tglx> <87jzshhexi.ffs@tglx> <87pm1c3wbn.ffs@tglx> <20231018103146.4856caa8@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231018103146.4856caa8@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 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, 18 Oct 2023 10:55:29 -0700 (PDT) On Wed, Oct 18, 2023 at 10:31:46AM -0400, Steven Rostedt wrote: > On Wed, 18 Oct 2023 15:16:12 +0200 > Thomas Gleixner wrote: > > > > 14. The kernel/trace/trace_osnoise.c file's run_osnoise() function > > > might need to do something for non-preemptible RCU to make > > > up for the lack of cond_resched() calls. Maybe just drop the > > > "IS_ENABLED()" and execute the body of the current "if" statement > > > unconditionally. > > Right. > > I'm guessing you are talking about this code: > > /* > * In some cases, notably when running on a nohz_full CPU with > * a stopped tick PREEMPT_RCU has no way to account for QSs. > * This will eventually cause unwarranted noise as PREEMPT_RCU > * will force preemption as the means of ending the current > * grace period. We avoid this problem by calling > * rcu_momentary_dyntick_idle(), which performs a zero duration > * EQS allowing PREEMPT_RCU to end the current grace period. > * This call shouldn't be wrapped inside an RCU critical > * section. > * > * Note that in non PREEMPT_RCU kernels QSs are handled through > * cond_resched() > */ > if (IS_ENABLED(CONFIG_PREEMPT_RCU)) { > if (!disable_irq) > local_irq_disable(); > > rcu_momentary_dyntick_idle(); > > if (!disable_irq) > local_irq_enable(); > } That is indeed the place! > /* > * For the non-preemptive kernel config: let threads runs, if > * they so wish, unless set not do to so. > */ > if (!disable_irq && !disable_preemption) > cond_resched(); > > > > If everything becomes PREEMPT_RCU, then the above should be able to be > turned into just: > > if (!disable_irq) > local_irq_disable(); > > rcu_momentary_dyntick_idle(); > > if (!disable_irq) > local_irq_enable(); > > And no cond_resched() is needed. Even given that CONFIG_PREEMPT_RCU=n still exists, the fact that run_osnoise() is running in kthread context with preemption and everything else enabled (am I right?), then the change you suggest should work fine. > > Again. There is no non-preemtible RCU with this model, unless I'm > > missing something important here. > > Daniel? But very happy to defer to Daniel. ;-) Thanx, Paul