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=1796154476; b=OB9ATB0dvjxeQ7GPk/3/kr5HlfjsJ1B21Pc53OSktj6bQRs2bXBjXEkm0EmUWa2xpN+B 2fwVLJgqj+5wh6gaxzD1bMkUSOIRyGTC4hqWc9DPVPePeaDlFDRfnOol/d5Ta5lvTYDL0 ymgtUGoExRFYF1HStkdH9ENzrFcKG31SzqaJyEBMzJYfpVHoUzD9uHuXZ+SydbmMpcfMe OHEWnj7WGTAw3ANfbhM5Uo8q/OEiOj0vuhkJVz3K3o87HnnDKIcwMD3cDUeAUnjnCgLVN XROv0ztPsvYsKvHyhazuYzVC6m4WPA7eEoDDmW+lXIajRHWUBBeIKPwUcuPurnOG9pg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796154476; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=QWfTI38fOHMyurR/5ekkwKOP5xHWmToGJqjn7OyC5K8=; b=c+DTMLs9OEsB6aBwh/tS83QRjQPjdpU5+ksNrZp5tESr82NzoS4yHvsyirfYcXP8ppLZ y331/pjUUsVdSd8Q8X7V016mbC+lY8oFKjtJA1fA4MD93WNA+CYnrWneEUM2PCd3VvrgT xxLY97llvS+ysui/7poZBdaveXQmp0YVDx+qvBxbIYVxvsV3Jl2/SXLG7RoCVNe2m/rBY cznBB4/FcW3N95YBjGKrh+RL1ql9YazAgl+GAEX69Ec2x73j/380HUWiBNDQmELQPIT/1 UEZEHPQJ0+eCCi31+UEVIdgtFeS6596Rlhf4Q2O93fhSfO39vOxCuEoRn2LKD5PfCgw== 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=Wj8C5oc7; 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 7DBA4606A32C; Tue, 1 Dec 2026 19:47:56 +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=Wj8C5oc7 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 152291F000C1; Tue, 1 Dec 2026 19:47:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796154476; bh=QWfTI38fOHMyurR/5ekkwKOP5xHWmToGJqjn7OyC5K8=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Wj8C5oc7x+WHMg0U9TOFuwc5ncasUEGDt6u5qG/6TkIdGoMwkekY9afz7MgSXR5vW iP3nEp2vqxnl4uTOr6E6VwMFBQvDU7yQ6fPQ1X3ZtvpZIY0s/JXBBdzXZk5yiluTQt io1skyCGsMaID/Bdn2g5VpR97YnyYI1dB0bWRZDwEDuhQ2g3BdNlkDX5Ef4v+JY+c5 nXzo3Q9IP/7WOgMiAycbABB09RpHCEwVRYD7XNeHyVrPyJxi+6Oq09vfAmpNiCL2Xn tPXBK0feeJQlg6T1KMlPiWsRZHAE5WXJpXXGfy58wSTArf/KH2xtadG3yZvznaHN87 I18UNhGuKcd4Q== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v13 32/36] sched/deadline: Count again a departed task that a boost brings back Reply-To: sashiko-reviews@lists.linux.dev To: "Mathieu Desnoyers" Cc: linux-rt-devel@lists.linux.dev, tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com, linux-kernel@vger.kernel.org In-Reply-To: <3d7f00e9dbb04f7337da5c038b3e32be017b98f6.1796146461.git.mathieu.desnoyers@efficios.com> References: <3d7f00e9dbb04f7337da5c038b3e32be017b98f6.1796146461.git.mathieu.desnoyers@efficios.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 19:47:55 +0000 X-Mailing-List: linux-rt-devel@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/deadline: dl_task_undepart() misses task asleep on inactive CPU -- commit f3cb39450dc2032dac32f84a5084f9b20d902cad Author: Mathieu Desnoyers sched/deadline: Count again a departed task that a boost brings back This commit re-accounts the bandwidth of a departed task when priority inheritance boosts it back into SCHED_DEADLINE after a root-domain rebuild dropped its bandwidth, and marks departed tasks left out during a rebuild in dl_bw_skip_gen. > diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c > index ef97b07c0aa21..d84a459e7a640 100644 > --- a/kernel/sched/deadline.c > +++ b/kernel/sched/deadline.c [ ... ] > @@ -436,16 +436,25 @@ static void dl_task_depart(struct task_struct *p) > cpu =3D cpumask_first_and(cpu_active_mask, &p->cpus_mask); > if (cpu < nr_cpu_ids) > dl_task_count_bw(p, cpu); > + else > + WRITE_ONCE(dl_se->dl_bw_skip_gen, dl_bw_gen); > } > list_add(&dl_se->dl_departed_node, &dl_departed_list); > } > =20 > /* > * Take @p off dl_departed_list. @p comes back to the deadline class, and > - * its bandwidth is that of a deadline task again. The caller holds the = rq > - * lock of @p. > + * its bandwidth is that of a deadline task again. @cpu is the CPU of @p. > + * The caller holds the rq lock of @p. > + * > + * A rebuild may have dropped the bandwidth while @p was departed. No > + * root domain counts it then, but this_bw of @cpu does again once @p is > + * back. Count it in the root domain of @cpu, as a move of @p would. If > + * the walk of the task list after a rebuild has not reached @p yet, > + * leave @p to the walk. If @cpu is not active, leave @p to its move to > + * an active CPU. > */ > -static void dl_task_undepart(struct task_struct *p) > +static void dl_task_undepart(struct task_struct *p, int cpu) > { > struct sched_dl_entity *dl_se =3D &p->dl; > =20 > @@ -454,6 +463,9 @@ static void dl_task_undepart(struct task_struct *p) > return; > guard(raw_spinlock)(&dl_departed_lock); > list_del_init(&dl_se->dl_departed_node); > + if (dl_se->dl_bw_gen !=3D dl_bw_gen && !dl_bw_move_blocked(p) && > + cpu_active(cpu)) > + dl_task_count_bw(p, cpu); > } [Severity: Medium] Can dl_task_undepart() skip dl_task_count_bw() or count the bandwidth in the wrong root domain when p is still asleep on the CPU that went offline or le= ft p->cpus_mask? affine_move_task() only migrates queued tasks, so if a departed task holding an rt_mutex stays asleep on CPU X while X goes offline, task_cpu(p) remains= X while dl_clear_root_domains() drops its bandwidth. When a deadline waiter then boosts p before p wakes up, switched_to_dl() passes cpu_of(rq) (X) to dl_task_undepart(), where cpu_active(X) is false, leaving p's bandwidth uncounted in total_bw until p wakes up (or for the whole boost if the waiter unblocks first), allowing sched_setattr() to admit tasks past the root domain's capacity. Similarly, if p was moved to another cpuset while asleep on an active CPU X, cpu_active(X) is true even though X is no longer in p->cpus_mask, so dl_task_count_bw() charges X's root domain instead of the root domain of p->cpus_mask. Should dl_task_undepart() resolve an active CPU in p->cpus_mask when @cpu is inactive or outside p->cpus_mask, the way dl_task_admit_cpu() does with cpumask_first_and(cpu_active_mask, &p->cpus_mask)? --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/cover.1796146461.gi= t.mathieu.desnoyers@efficios.com?part=3D32