From nobody Sun Oct 5 19:47:55 2025 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (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 2118B2D23BC for ; Thu, 31 Jul 2025 10:56:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753959367; cv=none; b=VHwroZLH1kxHketKRGv4EHMhRlMHstTnnauCKJMoJxGOJavM35/4ZUmF1/8tlKILZL4kIWzUxccN2Sf/DtvuNZ7CMqdkopC5xixFgBcUwwrQZdRywd0YK04oQkbHYnKSQnDF1ocKeieW3v6rurS+3YQkQaAGE84VxBnCVM9OICE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753959367; c=relaxed/simple; bh=CXH/nbHLh4BZqInfPZ2i20418s2hQeb0ON9avKB+N0g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dBqdD++Z/HTdRYi8EvP/rwp5hYFaTCTnjdq6UQGrNFncD+344O6MvxH4YXhaxbAqg5SGkcMFN1swTmH/S6V2YGc/snBSn/qxAawqHcOC8vPu5GXSQkqeHqJb8yrm9kjQUluqr4E+smFLm2+h2xjQ1B5MMdiSaiyscwksBItkCac= 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=EmDDztlT; arc=none smtp.client-ip=209.85.221.54 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="EmDDztlT" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-3b783d851e6so837752f8f.0 for ; Thu, 31 Jul 2025 03:56:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753959363; x=1754564163; 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=aloRYfRZHcWQKm9mHZFlIFmOkTIhwAj/KWqtVi8IvZo=; b=EmDDztlTGrXPH6PfrT8ynX8uXIon1lgGft6GGL0m3toaRbk9g5Y/Kqg66nL8zAk9eC LC1ecbDpVHg/UtLnFiZyFhX2UrX/i8bdr731zA9+DzmjdrfJUN3nrqzNBgH8IXd6Fr0c ZrUhqkelVbJeVCWweHz8PfCGVAiYEN0h6ddemlXhO9lojLNYSM801jxY7VsCkdISj3h+ Hqe8/cgL9Ppu+5oJ2u4JaspnoiNiH6JPBya0Elbflb56ku5CSYo4GaJnvZCI6wdnqBmT 23nD2KQaA7/zXWHfp/CXce2Vrzgn+mZ2/ygtAzgCx6M0NgPMsdOtdIk/O5HMYnwR54DS m2Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753959363; x=1754564163; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aloRYfRZHcWQKm9mHZFlIFmOkTIhwAj/KWqtVi8IvZo=; b=UvNgXGAE7d4A6/VkxJanIP2Nz1OA4jRJGrditE0WQCy2RXivRWIe/BQyF9NOiFwTlD lYtG+9bCCCYEgmthGnoFzumQ+ukRxo0E9mk5PKeay1kdvnxL959P7BlW0dGjtkv1mhwI RBoisAcuGKkvRJ2dSR5gjM7U2LNERNTIL79AbUVztpE30DDCCwvSxvfiow/hxeiptQrd FEreB+uVERmf02iszz3M2p5Zinp4hOplFfCeaE8OeBE7vx30jdvWRsU0JQsIrySPUDtg 36SzcLyDb0MrtDbSgF3zwqT6LpzdVrFCWJY1P/xyyGcF106hSniXD5HNsy/Syuvj71nD xlRA== X-Gm-Message-State: AOJu0Yz8FgL4qBrij/Ps8IxcnW42ohDgUNMYwyK9De+w47sgOM4cTttG 0sr4+s2BMkIYK8/Wv8Cne/q2nvuaqM62b35L0q/gjjfBgYiToeuoG/Ty X-Gm-Gg: ASbGncuFY2rfd+xIOLjWZ0lOgULTRuEOM2SqrmpUOK6obmc1m0BcpKY7rAru4R8Pe1s 85BySvFAY31j6676mak2d1MW3pI6gIDtVrI3WDlpEN7bIwLk12lHdbrMj4J7ko9i/Vl+wM90Jlg 4YiLt2kFq1SOgNVuU/WIJnDTnH+Gw3nY/H3nNfHD7qx7AoFeLlpoeHFiUQdT5jh8+KLXlQBQV2+ //Y03FLETZjkSdv7Kk39dV7G1d+L8HmW4ZengWDYLLAcdUbm1nJy+FGIe3eH7aZT6hGBko2zGkO l06B6k7u2tjrVsqjMlauAAX7Ch4pNlnD9ZWIazd2zOKfLF98yf4YiCtVXPWZ9kPymd6xkljirhO pMIkIc6CCeK7GVwNWhNw= X-Google-Smtp-Source: AGHT+IE2ZLE2HztsKXVGjNeZQAHYrlUVm+ngZJmjVVC6PQHo9dM2yJf52WCYd3LGT2NraaPiE+AosQ== X-Received: by 2002:a05:6000:4305:b0:3a4:f70d:a65e with SMTP id ffacd0b85a97d-3b794ffe750mr4987689f8f.37.1753959363375; Thu, 31 Jul 2025 03:56:03 -0700 (PDT) Received: from victus-lab ([193.205.81.5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c4696c8sm1946025f8f.55.2025.07.31.03.56.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Jul 2025 03:56:03 -0700 (PDT) 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 v2 24/25] sched/core: Execute enqueued balance callbacks when changing allowed CPUs Date: Thu, 31 Jul 2025 12:55:42 +0200 Message-ID: <20250731105543.40832-25-yurand2000@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250731105543.40832-1-yurand2000@gmail.com> References: <20250731105543.40832-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 eb9de8c7b1f..c8763c46030 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2947,6 +2947,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; =20 if ((flags & SCA_MIGRATE_ENABLE) && (p->migration_flags & MDF_PUSH) && !rq->push_busy) { @@ -2965,11 +2966,13 @@ static int affine_move_task(struct rq *rq, struct t= ask_struct *p, struct rq_flag } =20 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(); =20 if (complete) @@ -3024,6 +3027,8 @@ static int affine_move_task(struct rq *rq, struct tas= k_struct *p, struct rq_flag } =20 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 @@ -3037,16 +3042,19 @@ static int affine_move_task(struct rq *rq, struct t= ask_struct *p, struct rq_flag p->migration_flags &=3D ~MDF_PUSH; =20 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(); =20 if (flags & SCA_MIGRATE_ENABLE) return 0; } else { + struct balance_callback *head; =20 if (!is_migration_disabled(p)) { if (task_on_rq_queued(p)) @@ -3057,7 +3065,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(); =20 if (complete) complete_all(&pending->done); --=20 2.50.1