Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2409990rda; Wed, 25 Oct 2023 01:41:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH5FlO0bjMRdYdcF7BDqQi8TbvnrNRp3hJKh6yApKsDmtBiLppTDKnVGcqQdd1hEDcp0dZ6 X-Received: by 2002:a25:428e:0:b0:d90:c424:53ee with SMTP id p136-20020a25428e000000b00d90c42453eemr15191528yba.9.1698223290045; Wed, 25 Oct 2023 01:41:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698223290; cv=none; d=google.com; s=arc-20160816; b=V++avUlkHJBkuV+UMsRBBoEjbw2T+FHRmIgTsgpS2qk7WNDWk7sqM/gH8uQFW6H7dl Evyj9Zq51iKIhsOWlruh85iX4P1WcZW8rrJ8hr4VdKqRYh92ud2Qcge6rWXT8apNwyRn j7CzEFo4CIiljaTbwzp/6X3hNK3PP+F0LJQizTHPqoN8sW+QIesWeQl9AWRERvQLH4f3 6/jP3ODufIJaPD6ffksqHyhOTA8ES4JvJcR9ddNwNBPSEuATj3Xa21z5BvNTCOvXFFZT pAFQvkrNNRu7G0EDiTOMUVO5vol9QowRbU/+q+vmnb+EseU7LDa7OwVzqeJXlMFPcQES IZcg== 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:message-id:subject:cc:to:from:date:dkim-signature; bh=Cmhzrcr2aexRDjzc8+5eXPBKn4AD9mODxCPylln8cA0=; fh=86R/B5V1ffp7aQTFiuDXK+N3IccKiOjkE1XjmUDAtCs=; b=ZvUFNJSHOcqCO1RRKNqkqlV5yHMjmr/TGNlGmGFcvr1Nb5pA6sxboTD1p5SvfnvQG/ I+tSCi3HstB9RaS2feHho5tUJHIUX7rjMKEszuBMnhZ6afHXG5sLoeQu6TR73L8jLE/D tcOliT1hvTCUYi1W7VRXHbKAboxw7kuqaiQkqukWqcPtq1XS+EkGMG6CWFFCndjow8vj 0HoVXUwVuPLSyxlh9Of0IqY5v+WI7OK7MiqJeAOjIhnS1PsnkAsSrV9KOkHoftMPfaFW e0Rr6fRZ310LMvtPYcukW6VzZkbKzRv/dtcekdUZvf1VdPA5gM31suOBx77rnlAH6hka qIHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=mns5c3No; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id d196-20020a2568cd000000b00da045763691si3269768ybc.708.2023.10.25.01.41.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 01:41:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=mns5c3No; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 C02FC8077803; Wed, 25 Oct 2023 01:40:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232897AbjJYIkY (ORCPT + 99 others); Wed, 25 Oct 2023 04:40:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230217AbjJYIkX (ORCPT ); Wed, 25 Oct 2023 04:40:23 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F174C9C; Wed, 25 Oct 2023 01:40:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Cmhzrcr2aexRDjzc8+5eXPBKn4AD9mODxCPylln8cA0=; b=mns5c3NoOnkS1gg2eE5RNVE/61 +Ph6EQnBrGVGKlvxFgwIfKZtWvzk3fUem5fnCUECH1qdFPmJicVrDjNO/KeIj+0rGCFpxE9f+489K pn0yPAtw2+Ykq4LWkveMIkXu3ratPbqjZn1hJCl2B3A/eFoPfLmOHxtzBMp0RS6Fp/yI+GUaQNg+/ 8VlmoeLa+nMTSuB9yzBMh1iWmKwWoXhg6AfcEXoVHEy19HeQ47UOAuVdEfXZM4txjujZlNrG0u5S7 nJcGh0wZuYv5NUh7xF7ktIQ6x4NoxTlEahsGjywsc1Dail7cFAKNrydFutWEi8G4l+czGg1EKQX4N 8PdPzSiw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1qvZQu-007i90-Vz; Wed, 25 Oct 2023 08:40:09 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id A6BFB30047C; Wed, 25 Oct 2023 10:40:08 +0200 (CEST) Date: Wed, 25 Oct 2023 10:40:08 +0200 From: Peter Zijlstra To: Frederic Weisbecker Cc: LKML , Boqun Feng , Joel Fernandes , Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , Neeraj Upadhyay , "Paul E . McKenney" , Steven Rostedt , Uladzislau Rezki , Zqiang , rcu , "Liam R . Howlett" Subject: Re: [PATCH 2/4] rcu/tasks: Handle new PF_IDLE semantics Message-ID: <20231025084008.GD37471@noisy.programming.kicks-ass.net> References: <20231024214625.6483-1-frederic@kernel.org> <20231024214625.6483-3-frederic@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231024214625.6483-3-frederic@kernel.org> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,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 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]); Wed, 25 Oct 2023 01:40:37 -0700 (PDT) On Tue, Oct 24, 2023 at 11:46:23PM +0200, Frederic Weisbecker wrote: > +/* Check for quiescent states since the pregp's synchronize_rcu() */ > +static bool rcu_tasks_is_holdout(struct task_struct *t) > +{ > + int cpu; > + > + /* Has the task been seen voluntarily sleeping? */ > + if (!READ_ONCE(t->on_rq)) > + return false; > + > + cpu = task_cpu(t); > + > + /* > + * Idle tasks within the idle loop or offline CPUs are RCU-tasks > + * quiescent states. But CPU boot code performed by the idle task > + * isn't a quiescent state. > + */ > + if (t == idle_task(cpu)) { > + if (is_idle_task(t)) > + return false; > + > + if (!rcu_cpu_online(cpu)) > + return false; > + } Hmm, why is this guarded by t == idle_task() ? Notably, there is the idle-injection thing that uses FIFO tasks to run 'idle', see play_idle_precise(). This will (temporarily) get PF_IDLE on tasks that are not idle_task(). > + > + return true; > +} > + > /* Per-task initial processing. */ > static void rcu_tasks_pertask(struct task_struct *t, struct list_head *hop) > { > - if (t != current && READ_ONCE(t->on_rq) && !is_idle_task(t)) { > + if (t != current && rcu_tasks_is_holdout(t)) {