Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 161463B8111 for ; Tue, 28 Jul 2026 06:10:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785219010; cv=none; b=HeNs8NK+M3JcYG4A2ZSaGu8nK1FQDh+bgIobx11yC7HJ5Hn1DNMuO6bEK/45O33kf9I6k5qcswtIrsFX4IF2Vonjj0VlaWxViukJ0egE8WXncBBYfohbrBc7CYOZojvuKeWnshKScA+WBaZHYT3XlkAAecSLAGTRIWgyBJhp7y0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785219010; c=relaxed/simple; bh=eUAduvagUVxRo39UhVPwIPWlhk+08a8H/iJdklwqsLc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=IsT/U3P8QJhfdQQFf7FpXKICkf3eVu4DtX1CWJxq2pQ0AA4SOKsXB62WjzczXvo0WGiaME27FH6YxopFDsP+UInd67S9XrrOAgIZZwM203A5oIMy8a0palPC1lFxRL9oHbV92MNZl2RPCtNPHCqD5zE/9SpiiiXjuKLY7MJvpOs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: f6f84b348a4a11f1aa26b74ffac11d73-20260728 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.12,REQID:7719b851-5816-4385-988d-87bf2c59d957,IP:0,U RL:0,TC:0,Content:-5,EDM:25,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:20 X-CID-META: VersionHash:e7bac3a,CLOUDID:31b227da0bf3e2fd95a99c3d1ffc4f85,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:102|123|136|850|865|898,TC:nil,Content:0 |15|50,EDM:5,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OS I:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: f6f84b348a4a11f1aa26b74ffac11d73-20260728 X-User: luoliang@kylinos.cn Received: from localhost.localdomain [(10.44.16.150)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 1963428931; Tue, 28 Jul 2026 14:10:00 +0800 From: luoliang@kylinos.cn To: Tejun Heo Cc: David Vernet , Andrea Righi , Changwoo Min , sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org, Liang Luo Subject: [PATCH] sched_ext: Set errno on ENABLING -> ENABLED transition failure Date: Tue, 28 Jul 2026 14:09:55 +0800 Message-Id: <20260728060955.4102964-1-luoliang@kylinos.cn> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Liang Luo If the SCX_ENABLING -> SCX_ENABLED cmpxchg at the tail of scx_root_enable_workfn() fails, the function jumps to err_disable without setting ret. At that point ret still holds the return value of the last successful __scx_init_task() call, which is 0, so the err_disable fallback reports the meaningless message: scx_root_enable() failed (0) Set ret = -EBUSY, consistent with the other enable-state guards at the top of the same function, so the fallback always reports a real errno. Signed-off-by: Liang Luo --- kernel/sched/ext/ext.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c index 312938179e52..6a3e94707c8b 100644 --- a/kernel/sched/ext/ext.c +++ b/kernel/sched/ext/ext.c @@ -7520,6 +7520,7 @@ static void scx_root_enable_workfn(struct kthread_work *work) if (!scx_tryset_enable_state(SCX_ENABLED, SCX_ENABLING)) { WARN_ON_ONCE(atomic_read(&sch->exit_kind) == SCX_EXIT_NONE); + ret = -EBUSY; goto err_disable; } -- 2.43.0