From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796331041; b=BdzFK1N3Qnbf61r3rFR58YkQPDYSCnzjEnWAbqJWpGgaTUaLGEzmydF3H3AImE0ZImEv hLg9nUAC1bn4FADEJvFG5j0Cc+YcwOkUnKIOqJeycqyqDkZPYqny/BJD2zXWgpzlX/8BV u0v4DNKDRNGB+s/nlBd2h8TaAOeHFlCZ96M2s5FoVHdQwg7heAh4SL7At0YKYDKe5jvBM MQpIHfF9yLYMgg+EB6OrNPD0Wxqd+g4hbQP06KAW+0xPV3CK7ZB2NHaAsj2Ud+11U1dNJ fYWuJBeukQGFIPdllbQ8PNjQcQL9qfALE/QCYl/rjJPWmfHBgamHk2E7yjxTUvX8/Lg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796331041; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=mp3FZCysV9kdQl+nHyHCuhbt1jSP2fcEFzHk9Esv6L8=; b=TANUpeTk9Ua2UkVUkuZqMPpYkVxV4oVGr9CkF+eGhz8XS3J4QeANULBKu4KL6y1Xa+Pf h4fWtkHwL+FWBUbnKcn5d/eXsmlpbctx/EWFwwq+EbtD2njoLhrtPJyqctLmypCyis/am iHGdQI7klGmHrUt7+6esxuiBJSavx29ZcnGdFhml91TwjtMsr3Y2izBVM1DboesFDcFIf KPZa2jjmxWzsqyCABIIvsb+k2qVvwXWbin3L+j5EJvM5osSAILM3s8zeRyzbaXuVIZQka 1qZlihILO0MnfVKaGOVjd8XQ29QoCriA5EVzUgJkqRsx8x+F25rb8REPDngAePPlUBA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=F3QVkYOs; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A00CE606A322 for ; Thu, 3 Dec 2026 20:50:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=F3QVkYOs Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16FED1F0092B; Thu, 3 Dec 2026 20:50:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796331041; bh=mp3FZCysV9kdQl+nHyHCuhbt1jSP2fcEFzHk9Esv6L8=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=F3QVkYOsBzIWEIQ1aAYBlbEyyOjloW6y2nrBp71tUY0Tx/WrYbCZWnBNIg+HfCzRV xsFpoY2p4r1owDfyOvuEh5OYKTbjes6X+GTr0oHUcpIjyGRsIeeEA594t/P1O/hA7T uTIOAcFqhTzdKP4Y9EDCn4PPDiORBfk+mt0+ZAJo4+rf95Gef8Kk4L2huNTTLkgq1d w67FDVizZlK9g8yEB2XJZ1tcDgLMTMGwp7iKbfykPAwEt5P2ki3yyqC45nMgCvX8rU Fjqi3vrj/gnBfF1Azmidl5HEaKxAh/ufrTeSAeuYrpv3A5/o8lpn+9oAWuicsHNtDF euUPGvIQErH0g== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH sched_ext/for-7.4-fixes] sched_ext: Don't skip NONE tasks in sched_ext_dead() Reply-To: sashiko-reviews@lists.linux.dev To: "Chris Mason" , sched-ext@lists.linux.dev In-Reply-To: <20261203202815.32456-1-mason@kernel.org> References: <20261203202815.32456-1-mason@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 20:50:40 +0000 X-Mailing-List: sched-ext@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] sched_ext: unconditional task_rq_lock() in sched_ext_dead() on every exit -- commit 7328cb855c524883a9be737f7233e948be1c4e7b Author: Chris Mason sched_ext: Don't skip NONE tasks in sched_ext_dead() This commit removes the SCX_TASK_NONE skip in sched_ext_dead() so that every exiting task takes its runqueue lock, calls scx_disable_and_exit_task(), and transitions to SCX_TASK_DEAD. > diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c > index efa1d01d03afa..fd3d3d49be145 100644 > --- a/kernel/sched/ext/ext.c > +++ b/kernel/sched/ext/ext.c [ ... ] > @@ -4992,24 +4995,19 @@ void sched_ext_dead(struct task_struct *p) > * ENABLED transitions can't race us. Disable ops for @p. > * > * %SCX_TASK_DEAD synchronizes against cgroup task iteration - see > - * scx_task_iter_next_locked(). NONE tasks need no marking: cgroup > - * iteration is only used from sub-sched paths, which require root > - * enabled. Root enable transitions every live task to at least READY. > + * scx_task_iter_next_locked(). NONE tasks go through this too: the > + * sub-sched paths change the state under @p's rq lock, and > + * scx_punt_task() leaves a live task at NONE with its sched set. > * > * %INIT_BEGIN means ops.init_task() is running for @p. Don't call > * into ops; transition to %DEAD so the post-init recheck unwinds > * via scx_sub_init_cancel_task(). > */ > - if (scx_get_task_state(p) !=3D SCX_TASK_NONE) { > - struct rq_flags rf; > - struct rq *rq; > - > - rq =3D task_rq_lock(p, &rf); > - if (scx_get_task_state(p) !=3D SCX_TASK_INIT_BEGIN) > - scx_disable_and_exit_task(scx_task_sched(p), p); > - scx_set_task_state(p, SCX_TASK_DEAD); > - task_rq_unlock(rq, p, &rf); > - } > + rq =3D task_rq_lock(p, &rf); > + if (scx_get_task_state(p) !=3D SCX_TASK_INIT_BEGIN) > + scx_disable_and_exit_task(scx_task_sched(p), p); > + scx_set_task_state(p, SCX_TASK_DEAD); > + task_rq_unlock(rq, p, &rf); > } [Severity: Medium] Does dropping the SCX_TASK_NONE check add an extra rq->__lock acquisition on every task exit even when no BPF scheduler is loaded? finish_task_switch() calls sched_ext_dead() on every TASK_DEAD exit right after finish_lock_switch() drops rq->__lock and re-enables interrupts. Now every exiting task disables interrupts again, takes p->pi_lock and rq->__lock, and runs scx_reset_task_fields(), hurting exit-heavy workloads. Could this keep a fast path by checking scx_enable_state() =3D=3D SCX_DISAB= LED under scx_tasks_lock, since scx_root_enable_workfn() leaves SCX_DISABLED before taking scx_tasks_lock and scx_root_disable() returns to it only after draining all tasks and synchronize_rcu()? If the unconditional lock is kept, the commit message itself should also note this task-exit locking impact rather than leaving it below the --- separator. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203202815.3245= 6-1-mason@kernel.org?part=3D1