From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=158.69.130.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796309991; b=sfFX3z0EjM8htbuutyK/niZh4VwYOEWYukXAOmUdHikVgpQP2JokCHX1jhgzDCqB+MUb LTNQS3EjRW3N9Jxa6GrdCNv+BRfiF7BwtB5Sl4wzYFpEZKfWHaZub8ITO/oylvXCIcIkq Q7OLj5/XNpMsAV32XtVT6h6CcoXCllX1almN/3zyOTsFlpQ99Ze3dz87KTQB2lFhyBhiK 83yl4mpCUvq6tM9KCsmL4aJ4vKrt//JtAE8C7857/eGwNj+4g8CK9vplWHXPKJEQ7f14H YbTrMnCdKSXKwq09I1alD6PzOeVb6zWQ1VybR6JqQyo93PZqxNv7jWNlMyP53AdJGfg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796309991; h=DMARC-Filter:DKIM-Signature:Received:From:To:Cc:Subject:Date: Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=tzLcGvCdJokXi4hvqnuc/AKTEvr/fM4PNuGXusuGCCM=; b=C3Rx8rNhAfhq6l15Mi0IPc+7nCB54LoKYF3jtdUy8icK0Pvs4ej2iM3KiWpagzBUWqE/ OjbUF+Fvzu8CzINliINS7m6jYdzDmmNDHi2E7dRIQqBuOGV4IBtUIhcIjJBFjIhc4KNjG 4rLmaGcoLx3qQbixe+7+mSoqA2qZe+ogw9+YLVCAPsrWbMXL6XS6z911eVlTFFE6gFGsw iNC7Ljb+WsyseKhEGtWfHBHsCz3YC3wdbCzVhsYFsUqxCmNdl73v5y5UmB2XanokUimCO 6WLGhUBjtLzHGoDKr4zFGCd6CVdqysuyBMiBDeS4JnKpA0BasG4BvQsa1CqqcxZMcnA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=efficios.com; spf=pass smtp.mailfrom=efficios.com; dkim=pass header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=smtpout1 header.b=SGmNhNt4; arc=none smtp.remote-ip=158.69.130.18 Received: from smtpout.efficios.com (smtpout.efficios.com [158.69.130.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 D961F60A6F7E; Thu, 3 Dec 2026 14:59:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D961F60A6F7E Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=efficios.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=smtpout1 header.b=SGmNhNt4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=smtpout1; t=1796309990; bh=tzLcGvCdJokXi4hvqnuc/AKTEvr/fM4PNuGXusuGCCM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SGmNhNt43oW10mCZqK0vxMSleqUhjeWpEB8sDQTFD9zO+SO2EO7KB+IyTqDTl4kco s4tQKYdWDAYOsdycHedEAhwPyXliUp82RBilKZHhPdtymhDtZ4bHqX5bCsTH+qpFCS OQ+trSKLNo4vmm9je9HF8rGgoX3byxGHad4rTqSiuVSGCjKKK9H3ll8eg2zTkngklb iEdSD0JNHCid6Yexr9YyoaOusIYdzP+elRMWkBMZG4Q7t98X8rBmTo8D/Eiz9yeUyz bD9kWjUbBLXN3dYmJq1w1Bua2Dq3A3ZL24rCynlyBz9m1IO5eRgaRrxJulEKmlgLvr Veaj2oVQWfbpg== Received: from thinkos.internal.efficios.com (unknown [IPv6:2605:8d80:7180:6739:ac39:5d4:4093:61c6]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4jgHpr2WMQzZWt; Thu, 03 Dec 2026 09:59:48 -0500 (EST) From: Mathieu Desnoyers To: juri.lelli@redhat.com, peterz@infradead.org, mingo@redhat.com, vincent.guittot@linaro.org Cc: Mathieu Desnoyers , tglx@kernel.org, anna-maria@linutronix.de, frederic@kernel.org, will@kernel.org, boqun@kernel.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, kprateek.nayak@amd.com, luca.abeni@santannapisa.it, tommaso.cucinotta@gmail.com, mathieu.poirier@linaro.org, longman@redhat.com, ridong.chen@linux.dev, tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com, shuah@kernel.org, bigeasy@linutronix.de, clrkwllms@kernel.org, parri.andrea@gmail.com, m.szyprowski@samsung.com, kayracizmeci@gmail.com, weihengqiuu@gmail.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-rt-devel@lists.linux.dev, oleg@redhat.com, brauner@kernel.org, stable@vger.kernel.org Subject: [PATCH v14 27/39] sched/deadline: Count only active CPUs when spreading extra_bw Date: Thu, 3 Dec 2026 09:58:41 -0500 Message-ID: <6563c5a25a245460f28ae1ea7000c7e3446dbc88.1796296313.git.mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: References: X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit __dl_add() and __dl_sub() change the total_bw of a root domain. They also spread the change over the extra_bw of its CPUs, which GRUB uses for SCHED_FLAG_RECLAIM tasks. __dl_update() changes only the active CPUs, so the cpus argument must count those. Most callers pass dl_bw_cpus(), which does. dl_task_offline_migration() and dl_add_task_root_domain() pass cpumask_weight(rd->span) instead. That also counts the inactive CPUs of the span. A span holds one while that CPU goes offline, which is when dl_task_offline_migration() runs. Each active CPU then gets a smaller share of the change than it should. A later change made with dl_bw_cpus() does not undo it exactly. extra_bw stays off until the next rebuild of the root domains resets it. SCHED_FLAG_RECLAIM tasks would reclaim a little more or less than their share meanwhile. This was found by reading. Fix this by passing dl_bw_cpus() of the CPU whose root domain changes. Fixes: 59d06cea1198 ("sched/deadline: Fix bandwidth accounting at all levels after offline migration") Fixes: f9a25f776d78 ("cpusets: Rebuild root domain deadline accounting information") Signed-off-by: Mathieu Desnoyers Cc: stable@vger.kernel.org --- kernel/sched/deadline.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 859977bcc01f..081c5812a063 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -1085,7 +1085,7 @@ static struct rq *dl_task_offline_migration(struct rq *rq, struct task_struct *p dl_b = &src_rq->rd->dl_bw; raw_spin_lock(&dl_b->lock); __dl_sub(dl_b, p->dl.dl_bw, - cpumask_weight(src_rq->rd->span)); + dl_bw_cpus(cpu_of(src_rq))); raw_spin_unlock(&dl_b->lock); } /* @@ -1097,7 +1097,7 @@ static struct rq *dl_task_offline_migration(struct rq *rq, struct task_struct *p dl_b = &later_rq->rd->dl_bw; raw_spin_lock(&dl_b->lock); __dl_add(dl_b, p->dl.dl_bw, - cpumask_weight(later_rq->rd->span)); + dl_bw_cpus(cpu_of(later_rq))); raw_spin_unlock(&dl_b->lock); dl_record_bw_cpu(&p->dl, later_rq->cpu); p->dl.dl_bw_gen = dl_bw_gen; @@ -4432,7 +4432,7 @@ void dl_add_task_root_domain(struct task_struct *p) dl_b = &rq->rd->dl_bw; raw_spin_lock(&dl_b->lock); - __dl_add(dl_b, p->dl.dl_bw, cpumask_weight(rq->rd->span)); + __dl_add(dl_b, p->dl.dl_bw, dl_bw_cpus(cpu)); raw_spin_unlock(&dl_b->lock); dl_record_bw_cpu(&p->dl, cpu); p->dl.dl_bw_gen = dl_bw_gen; -- 2.47.3