From nobody Mon Dec 1 22:02:36 2025 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B521A31062E for ; Mon, 1 Dec 2025 12:42:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764592953; cv=none; b=Qp8uITlr8Xe6NeAW1BdWqoxZ9zCERUasCIz5kZVXFwMwRD4nCYnoSZ4x6xLhtr9PqJknaoBD6WO4OeWxaG/QMI57S5EEghVyRFav+KOGYjejavoV0bpmwwbNc2MMv07UIP5Cqx2Gg70RjR5K01DMxh1+2riE54Tata78v9MorYs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764592953; c=relaxed/simple; bh=apBDXQWtxNCJR6bL8tBtybLIUn1s8pXxXJIoKUni/D0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hg+WCHidWDL3y3L1/C4d3uUx0mZNh2ZUPMaZtltXPm1nVDkINS4mvY0f0oGv+CxYnP58rXN133l1XCOgpwn9MmPCMx4E3qs9CmTKtf7OoWpc566nkUswgKkVX0nM6U5xwy2azqg7kyRfR1Tw+KnoZvjkorcvwuDk6wQpyWECB7s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TiyR0csk; arc=none smtp.client-ip=209.85.208.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TiyR0csk" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-6419aaced59so6187581a12.0 for ; Mon, 01 Dec 2025 04:42:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764592949; x=1765197749; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/gXTXiM+VuRz2Zb4Y6AlTWBmDw4CXW0a5IFGDZK1PxY=; b=TiyR0csklwS/mgc9Vc/ubkODHX619enhyacoawswB5HKBEOD+YLIjd1augJ5rK9p3D 21XzcMwzyRuTdAvCk4Cs2zTB080V/SC5llAgnO6TaU17gBZ3IRNqMEd6dObbIWDx9ji2 lq4MQA2hkDcYPdoUo7SHIoOGYxGxNMjB/LzDEjkUY2vo5xb1Qbxu33h1g8vQaFMa2VkL 2avqnzyRgmyxVTK6JcrAOzhsHISLXGz68OMVXlDMp7/34pv34nXdy3vmF5QsZdsxIkin ZBUdP7sF1Gq9TlufGhfT/1RtR1bdSzHiG2GE8CXD1wt7JjcfOQeJnD60iS9EhC6PY7rY UJuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764592949; x=1765197749; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=/gXTXiM+VuRz2Zb4Y6AlTWBmDw4CXW0a5IFGDZK1PxY=; b=DFKut2jyfN1BKpLmsxFF2jDxgq6sr8LlT0ktHd6YNMwUt+Qvq/fC66QXXyizzw2GrI hUyrurjOHZ/84LhY1+iucm0nLEbyq+3A/G2E+3l56VD9ldktDnls/h3tEnxMP3eG8WD1 FqngL9T1s3tdBTU6BPoceKJyGCZQ9hVA2kgI0VdI5/D89uvkpdhYn4ayWDf6+8cIbuJb HcWmwmy1o1zF1z+VVGeUiuY6BBmPEqSOM7LJSXiIXka/QMZ0rWAlLHqn1zdreBBRgPhH +C1D3cR0h8imk1bw5xiK9hwH34oA0TaWAIyLwG0uPhophCsdyo4iWHNX8h0sPxsipCXW +9mw== X-Gm-Message-State: AOJu0YymmlzDNXQQZ1ZJJFCj4FkHsgxPP5Qt1aORYo7206rq1OeP3+ls 09O5eUd+Y0UBmO9dOS08IuGztphLc61RNoyRWQIof+n5RIfuSo+yg4IH X-Gm-Gg: ASbGncu2tWf2Dakk25zmiwultK8q7QePPPLEuoWOZ+uyDzKUMn1WWhr+tHNRH6nzrVB TUAXA/4uuFroLu1Y0p0bVH1Jv9yN3ZshrJCNXP/0VcMB1pigW38GjkL6s2LvqrE4qYAqcawWrga +D6ZlCTw/teWiBEVaRcYW3ePfbNh8G8JPSfELMtvanDF+XkOuMfkiGB7f0tEdid/feDjPRmtlIO mlQ4UdYR6AF1tD3CIjsvFF+DtCoobagUIOUM+RZUGczlkfQOoL54hgUG48vdo7AkfAYQfhoc38Z jEvLj6UnD1ziIStHhGjEwZjwPvGf0iIHZXHrpzw5tVJJ7VlYm1nxJ+xY9/dSbsyL4R8O7nHPB4s R3Tdx+QKiMVR8QhYpeinMJ+k4epcKltOBDyQJHexyLbUa6AdrL5vkbdgzE3/3AeZjBDMxNhMypY VCuGg67L7D X-Google-Smtp-Source: AGHT+IHu/oPE1WrdASzcdY8P4h5akCVYBd7T6j6/eOXhOSygoG1UjI/TlrE7ZF0iJejgDtwd6/dN8Q== X-Received: by 2002:a17:907:3f14:b0:b71:5079:9702 with SMTP id a640c23a62f3a-b76715ab943mr3856301066b.21.1764592948587; Mon, 01 Dec 2025 04:42:28 -0800 (PST) Received: from victus-lab ([193.205.81.5]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b76f59e8612sm1173738266b.52.2025.12.01.04.42.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Dec 2025 04:42:28 -0800 (PST) From: Yuri Andriaccio To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider Cc: linux-kernel@vger.kernel.org, Luca Abeni , Yuri Andriaccio Subject: [RFC PATCH v4 24/28] sched/core: Execute enqueued balance callbacks when changing allowed CPUs Date: Mon, 1 Dec 2025 13:41:57 +0100 Message-ID: <20251201124205.11169-25-yurand2000@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251201124205.11169-1-yurand2000@gmail.com> References: <20251201124205.11169-1-yurand2000@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: luca abeni Execute balancing callbacks when setting the affinity of a task, since the HCBS scheduler may request balancing of throttled dl_servers to fully utilize the server's bandwidth. Signed-off-by: luca abeni Signed-off-by: Yuri Andriaccio --- kernel/sched/core.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 983cd1b478..2c08f31d3d 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2915,6 +2915,7 @@ static int affine_move_task(struct rq *rq, struct tas= k_struct *p, struct rq_flag if (cpumask_test_cpu(task_cpu(p), &p->cpus_mask) || (task_current_donor(rq, p) && !task_current(rq, p))) { struct task_struct *push_task =3D NULL; + struct balance_callback *head; if ((flags & SCA_MIGRATE_ENABLE) && (p->migration_flags & MDF_PUSH) && !rq->push_busy) { @@ -2933,11 +2934,13 @@ static int affine_move_task(struct rq *rq, struct t= ask_struct *p, struct rq_flag } preempt_disable(); + head =3D splice_balance_callbacks(rq); task_rq_unlock(rq, p, rf); if (push_task) { stop_one_cpu_nowait(rq->cpu, push_cpu_stop, p, &rq->push_work); } + balance_callbacks(rq, head); preempt_enable(); if (complete) @@ -2992,6 +2995,8 @@ static int affine_move_task(struct rq *rq, struct tas= k_struct *p, struct rq_flag } if (task_on_cpu(rq, p) || READ_ONCE(p->__state) =3D=3D TASK_WAKING) { + struct balance_callback *head; + /* * MIGRATE_ENABLE gets here because 'p =3D=3D current', but for * anything else we cannot do is_migration_disabled(), punt @@ -3005,16 +3010,19 @@ static int affine_move_task(struct rq *rq, struct t= ask_struct *p, struct rq_flag p->migration_flags &=3D ~MDF_PUSH; preempt_disable(); + head =3D splice_balance_callbacks(rq); task_rq_unlock(rq, p, rf); if (!stop_pending) { stop_one_cpu_nowait(cpu_of(rq), migration_cpu_stop, &pending->arg, &pending->stop_work); } + balance_callbacks(rq, head); preempt_enable(); if (flags & SCA_MIGRATE_ENABLE) return 0; } else { + struct balance_callback *head; if (!is_migration_disabled(p)) { if (task_on_rq_queued(p)) @@ -3025,7 +3033,12 @@ static int affine_move_task(struct rq *rq, struct ta= sk_struct *p, struct rq_flag complete =3D true; } } + + preempt_disable(); + head =3D splice_balance_callbacks(rq); task_rq_unlock(rq, p, rf); + balance_callbacks(rq, head); + preempt_enable(); if (complete) complete_all(&pending->done); -- 2.51.0