From nobody Sun Feb 8 02:34:55 2026 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (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 2DEF0249F1 for ; Mon, 4 Mar 2024 09:48:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709545727; cv=none; b=SCwQtEiyNpPmmB0j7DR6WNE1HoAB/kwGxI1KIfn8vcawh4VzHQh+DweQdJVsJpJrDHqovpXkB50l1x5YTLhaeYcFjFEwFVBbEb4E2UBgTGgkNQd5r1r1cG3ZTOoX27Z/fccjY0s2XAg+qSZlW8uUPrGk9u2zwvT8uRmgsEwa2Zo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709545727; c=relaxed/simple; bh=NL0X0BOz7ZVywJyCc8r0y4XYQQ5/b+5FbeyYJW/2ZGY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tqvt8FKmfs1rrn1wLI7/bZaQ1OFdmWkcVXcY9bvTRwAsXLmsmAEkUPyGMOuAUIiK1KaAtcm/g8X9gK0MoLquykEVNvp2Li+OIorreFIsVhIxofN7u4kMhcoGEueejrkqtkscHBTP/aBFAJwBh2fYdZ2blut8wbLfEd8k3I8TVRQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mQJ4W/fa; arc=none smtp.client-ip=209.85.218.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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="mQJ4W/fa" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a3f893ad5f4so635254766b.2 for ; Mon, 04 Mar 2024 01:48:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709545723; x=1710150523; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=PRfa5V1eCtQKvE35o3iYx+TIdATo30V6vBwFI6v4hE8=; b=mQJ4W/fatDtMSbNByqeVC1RFOiQBlKcMOWxA8PmfMEiE3lRsJnlIBAUJDV1dfaURnJ uohkLnR5dako6shk0ZG+OM6QCLBo35nD7TZe80Se3kKG7/E1lUjxuAeRjcv2sy/vrlYZ LJIidLr2SvdJ4p4uqpokt/010YO6YLlI6GQCGRQxsrD+O5Wf5YaYnVNSqsT6w3Vqarki N+WbeIGMPLbBvpoc+3AExM1K7rs8eoUOG9VyZr62yIqv1OLVvPFwpdbLZu1Gsqo76hPH zCxEmUAT/SB7N1AYinKx1FkMqytmI/zzE+Oc+WFJq6JlrZEFUSpn4uEtulvx22CZyua1 eMsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709545723; x=1710150523; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=PRfa5V1eCtQKvE35o3iYx+TIdATo30V6vBwFI6v4hE8=; b=tR2dX2tJJRahN6pqqnccWuL2n0jrAo5H3nZBxB7xk3Q8norTobstpUlMjdowN5b6/j eI1rahyL5KNzSAIEno1r/BZ4/ByXA8KMYLRw1S0UZ/UUQg6NS3ESuGLoRyuUNP0wjkl+ NwJ+n7IseevDxR9VYqJICnPlARs9YNa8qYpmas4pUo+LhtJ7la6mzb3atxc8IBvOC0zk h4RtxceppoUSI4A5ehy5Hz+5UpV0moKAMfT+J7fomP/LFoNSPcvqmtxmyh9v1BWD0jRR m8iJk4upQ0q7+1UBcmjv1Conx7ODzWGDTWEXunD14zTMlFRoBuy8ROS8eRx6PKQ3Qs5E kA3A== X-Gm-Message-State: AOJu0YzIIGrehYyq01VQJvXwhJL2qpavkihYVy4lzDg2BMFN4a8PXJIJ VARjxbP1h6uiAKMKsnZssgW8vh0OZW4OwR1rUfbMDs80+4prtve/M+lpwqZ2maA= X-Google-Smtp-Source: AGHT+IG3FrZJUDTQ/cSxrdKEWOX1gTAVyQNE5NnJ4ilIzZcjXgY9mLDazaJkChHravh9KZKHQ4KVVQ== X-Received: by 2002:a17:906:f190:b0:a44:2134:cba9 with SMTP id gs16-20020a170906f19000b00a442134cba9mr5448481ejb.69.1709545723528; Mon, 04 Mar 2024 01:48:43 -0800 (PST) Received: from kepler.redhat.com (1F2EF13F.nat.pool.telekom.hu. [31.46.241.63]) by smtp.gmail.com with ESMTPSA id s22-20020a170906501600b00a42e2bc82dbsm4569839ejj.169.2024.03.04.01.48.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 01:48:43 -0800 (PST) Sender: Ingo Molnar From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Shrikanth Hegde , Peter Zijlstra , Vincent Guittot , Dietmar Eggemann , Linus Torvalds , Valentin Schneider Subject: [PATCH 1/9] sched/balancing: Switch the 'DEFINE_SPINLOCK(balancing)' spinlock into an 'atomic_t sched_balance_running' flag Date: Mon, 4 Mar 2024 10:48:23 +0100 Message-Id: <20240304094831.3639338-2-mingo@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240304094831.3639338-1-mingo@kernel.org> References: <20240304094831.3639338-1-mingo@kernel.org> 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" The 'balancing' spinlock added in: 08c183f31bdb ("[PATCH] sched: add option to serialize load balancing") ... is taken when the SD_SERIALIZE flag is set in a domain, but in reality = it is a glorified global atomic flag serializing the load-balancing of those domains. It doesn't have any explicit locking semantics per se: we just spin_trylock() it. Turn it into a ... global atomic flag. This makes it more clear what is going on here, and reduces overhead and code size a bit: # kernel/sched/fair.o: [x86-64 defconfig] text data bss dec hex filename 60730 2721 104 63555 f843 fair.o.before 60718 2721 104 63543 f837 fair.o.after Also document the flag a bit. No change in functionality intended. Signed-off-by: Ingo Molnar Cc: Peter Zijlstra Cc: Vincent Guittot Cc: Dietmar Eggemann Cc: Linus Torvalds Cc: Valentin Schneider Reviewed-by: Valentin Schneider --- kernel/sched/fair.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 6a16129f9a5c..64ae3d8dc93b 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -11633,7 +11633,20 @@ static int active_load_balance_cpu_stop(void *data) return 0; } =20 -static DEFINE_SPINLOCK(balancing); +/* + * This flag serializes load-balancing passes over large domains + * (such as SD_NUMA) - only once load-balancing instance may run + * at a time, to reduce overhead on very large systems with lots + * of CPUs and large NUMA distances. + * + * - Note that load-balancing passes triggered while another one + * is executing are skipped and not re-tried. + * + * - Also note that this does not serialize sched_balance_domains() + * execution, as non-SD_SERIALIZE domains will still be + * load-balanced in parallel. + */ +static atomic_t sched_balance_running =3D ATOMIC_INIT(0); =20 /* * Scale the max load_balance interval with the number of CPUs in the syst= em. @@ -11711,7 +11724,7 @@ static void rebalance_domains(struct rq *rq, enum c= pu_idle_type idle) =20 need_serialize =3D sd->flags & SD_SERIALIZE; if (need_serialize) { - if (!spin_trylock(&balancing)) + if (atomic_cmpxchg_acquire(&sched_balance_running, 0, 1)) goto out; } =20 @@ -11729,7 +11742,7 @@ static void rebalance_domains(struct rq *rq, enum c= pu_idle_type idle) interval =3D get_sd_balance_interval(sd, busy); } if (need_serialize) - spin_unlock(&balancing); + atomic_set_release(&sched_balance_running, 0); out: if (time_after(next_balance, sd->last_balance + interval)) { next_balance =3D sd->last_balance + interval; --=20 2.40.1 From nobody Sun Feb 8 02:34:55 2026 Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (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 220E4249F3 for ; Mon, 4 Mar 2024 09:48:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709545727; cv=none; b=M67OQ4VGQPP6vq0c2LfnHlqD3XTccMGkkOErxckpGx4kHH7dl2VwYHfjnOkp/06O3WqRRiiM1kkWcaicv/jrO1r4RIfUq5S1zd+B4VhlprPjZmCSEnYvz/14kma9O5QQN8Fz7lhm4ndZvfo2a5kOEbHnk+2TzhH4SerwKczfaSo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709545727; c=relaxed/simple; bh=MzgCGm4DkmCkgSo9Fwl5qScTKTAx39yHwF+oGgxbR/8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hoyh+sCDJ892DCDwxUXYWTK+2U0cz/LyjMSzOlnBXPjzDSLJZ+1AZ+icunGqcIrTtWH39e88+UtPiUMB4nxeEoF0rPgbATKaPjwOdvnz5t7hOdnNXVJCzduJFZDeac54wF35qGvBIBe6CCatrDR4o3uFw0aY2s7JvLbsLEDktHE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bnAzd6Kv; arc=none smtp.client-ip=209.85.218.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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="bnAzd6Kv" Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-a36126ee41eso648191366b.2 for ; Mon, 04 Mar 2024 01:48:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709545724; x=1710150524; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=dPxGhOU8RasJef8Q2V28r0rMSdjIoPzVN4GRwFqx08I=; b=bnAzd6Kvkktz8mW7ZoNQHCfR3gSVTxJNhmKFw4pubL1TIZZfNUp5qJBuf9je+nnzpe OPe1MgbEIWpq/Gb9X7gkOmJYMHI3Lb+oLgj7Ha73plpARl7u3A/MnoGXfM+RoUGBsK44 HdLTl8S5BjfQizD08ME24X/KA0UFfQKyWdMs4yzOJZx8Mylc4e1JzrXjoPgs3WZIIIBj EkC9zpdgJz+ce8/d74o+BElEszHnLKecFSwll4Me8cL7epGiWyxgBsYonhyoPkNv1n1E m6GVoccSsWS45bJIp6cQXAPHth1ADedZmuoVfAOdKNHaw8pE9ek/e3lg08o7vBNuWMFS pLVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709545724; x=1710150524; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=dPxGhOU8RasJef8Q2V28r0rMSdjIoPzVN4GRwFqx08I=; b=mnYlTY1gsM0iODKoJirCMTvQv1b01n8siQr7hS+XXMNcOyVJHzB3K59tVMluCtjN4K +Xz29Bh9O3oOelAXinbxt6HX7hKT01qAwPhDWhzQRAEdDv65QT6J4qDEN948sCElheIy yFnVpJ61XOR7OzG7ghnNiYAGMkctd07x5qCzjqJxKgfyCyl/Nj3Q/zYsKmdJlYROiHfZ ZfdW5+2NZqgmXySs9uwkKLq39LDrOnL7x0PjPtJDG0LHi8OezOleybHZnsRLiB88jg4m n4+EqOXPJW8Vs/5NbQFGbfNLBlYXuC1T4j7WQtUwEWpf9xR+b6220k9/tpW3VeNjM1eq Mz/Q== X-Gm-Message-State: AOJu0Yz8NRNUIOL6i2AxIuUTpezGARUDZZZO5G4gEtwrMS4JpwF3poyR 4BCAYPoGCh1Eq+VBe8tl9vD4UJVfoNrdCC5tqXOuUefnRwAwghcx/pwwC4ETH3c= X-Google-Smtp-Source: AGHT+IG6wrOmtjndbSn9gZFusYafkuuV/lv/Fk2FB+1cNj7V071mAUwIwkmsk53uVmKM9d82EmaNbw== X-Received: by 2002:a17:906:6b94:b0:a45:26fd:f5aa with SMTP id l20-20020a1709066b9400b00a4526fdf5aamr2226490ejr.17.1709545724507; Mon, 04 Mar 2024 01:48:44 -0800 (PST) Received: from kepler.redhat.com (1F2EF13F.nat.pool.telekom.hu. [31.46.241.63]) by smtp.gmail.com with ESMTPSA id s22-20020a170906501600b00a42e2bc82dbsm4569839ejj.169.2024.03.04.01.48.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 01:48:44 -0800 (PST) Sender: Ingo Molnar From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Shrikanth Hegde , Peter Zijlstra , Vincent Guittot , Dietmar Eggemann , Linus Torvalds , Valentin Schneider Subject: [PATCH 2/9] sched/balancing: Remove reliance on 'enum cpu_idle_type' ordering when iterating [CPU_MAX_IDLE_TYPES] arrays in show_schedstat() Date: Mon, 4 Mar 2024 10:48:24 +0100 Message-Id: <20240304094831.3639338-3-mingo@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240304094831.3639338-1-mingo@kernel.org> References: <20240304094831.3639338-1-mingo@kernel.org> 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: Shrikanth Hegde Shrikanth Hegde reported that show_schedstat() output broke when the ordering of the definitions in 'enum cpu_idle_type' is changed, because show_schedstat() assumed that 'CPU_IDLE' is 0. Fix it before we change the definition order & values. [ mingo: Added changelog. ] Signed-off-by: Shrikanth Hegde Signed-off-by: Ingo Molnar Cc: Peter Zijlstra Cc: Vincent Guittot Cc: Dietmar Eggemann Cc: Linus Torvalds Cc: Valentin Schneider --- kernel/sched/stats.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/sched/stats.c b/kernel/sched/stats.c index 857f837f52cb..85277953cc72 100644 --- a/kernel/sched/stats.c +++ b/kernel/sched/stats.c @@ -150,8 +150,7 @@ static int show_schedstat(struct seq_file *seq, void *v) =20 seq_printf(seq, "domain%d %*pb", dcount++, cpumask_pr_args(sched_domain_span(sd))); - for (itype =3D CPU_IDLE; itype < CPU_MAX_IDLE_TYPES; - itype++) { + for (itype =3D 0; itype < CPU_MAX_IDLE_TYPES; itype++) { seq_printf(seq, " %u %u %u %u %u %u %u %u", sd->lb_count[itype], sd->lb_balanced[itype], --=20 2.40.1 From nobody Sun Feb 8 02:34:55 2026 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (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 5131A224DE for ; Mon, 4 Mar 2024 09:48:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709545729; cv=none; b=o3Xqudn/Qwfxbl+eMQ/NmKtfHCIEX7newRa1fjrmt8/lrmnbru2HDcz1WSYZvz7i6E5lgsJ0EOzDXckeQro1VUgE1Eh8eHodfAsTt9WZ0ej9/RLlwbaIHDj5RLzzfp1np+wGjXtlY6iKWlRFZwg1vwlcgTYYn0OYd/N63aDRONc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709545729; c=relaxed/simple; bh=wGnnv0R/i5/PFNWqQGKADyW9AWcXKqVYmEaB4jhEARo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Uv2R86xryxpMtFNl4YIhpsJUEo6y8SQWm5faKJ7YB6AF4Mvr+8e4UMZapNKBc+WMAn5K6tE5n4dBp6Eow3zgwneFLZ9iNAecCgsQJNMGjvatyBfvq1AIVz4upveluLKBa756jKGaZj5KjTkDGK+U3XUYUra/eHXnY6zDU+w+mdM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MJzpPPBG; arc=none smtp.client-ip=209.85.218.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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="MJzpPPBG" Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a44665605f3so445951166b.2 for ; Mon, 04 Mar 2024 01:48:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709545726; x=1710150526; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=tqL84XLNVn0Cp5LtqkDs2ZJplR67S7lT/DN/daWYchI=; b=MJzpPPBGzzB+wocEiP2Lw1a22hifMTk0ye6X+OxnJHMTmWCRORlXrCqAznkQd5Wg/t svd4fH+q7+n9HSOH3zS8E5LFYlmWEX85BXUO9Mw47wjK2IMZSE9Ry12/Y3Wlwd9m2dwu /C3s3XePCGcXyEVE2WFwK2h/gTPj0I2R7WPC6hnYV1ysUngpaiecY7x1LPJYfBrs433a nh7CIojBtPmGIARiYiPY5SfJmPf7WhTZHwAHKdQ++VSM9htfqjqluEnLECU2jQADa0HF fqZZRValzIuvMZOB38WvxDzPnoQ74x2vJER1I72csJyXe1TSuRJD+OyULjFHW7qqthYs 2Qwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709545726; x=1710150526; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=tqL84XLNVn0Cp5LtqkDs2ZJplR67S7lT/DN/daWYchI=; b=kLx/wNgwyVFW9DMYKarMwMNXxuoq1/kxYtrlCq+5rZ/m3xgKFnQ4M3IVaeqBf+Rwar G1PzRUpYXw0cMdqzLEW7amlueJVHJVdqHypaaU40fedOgg2WWFQKfbhAPhWXfXxuu1sv z/11N0iJWzJWU5ouNWvO9fhm2PpxBh/e6FFpOCf7NukJpHq2W5127ya82Zi7AT+3BmhT VkCILEgAT4XrzHiE2I6D2cBRwtiWi60doRA39Jt2amVgn1yrxF9+t2zmPCZIpe/pGH8X U9wrmqqhUIjgdelhnVl7kxnckkmysy3IBrJMWrq4w+bcSknDlr1029rykAEWeosAvanf TWxg== X-Gm-Message-State: AOJu0YyrKfBWjvAen12XFFrurtO7XSRkSXGM/TbGnVjvvGM/cP1eNBkb JRbHbk3iTWlFYqJ7zsp07MdJXt/gZqVwQFgXjx3GaPKtqENjmpy1CGPofbtfrdU= X-Google-Smtp-Source: AGHT+IHV0HTMqTVqrfr0L03RNRjP18egljCvxPlSy3wm30aYM2snihMa+ewSPAaFDShsElvpB+I4YQ== X-Received: by 2002:a17:906:19cf:b0:a44:1f20:e6d6 with SMTP id h15-20020a17090619cf00b00a441f20e6d6mr5618226ejd.1.1709545725576; Mon, 04 Mar 2024 01:48:45 -0800 (PST) Received: from kepler.redhat.com (1F2EF13F.nat.pool.telekom.hu. [31.46.241.63]) by smtp.gmail.com with ESMTPSA id s22-20020a170906501600b00a42e2bc82dbsm4569839ejj.169.2024.03.04.01.48.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 01:48:45 -0800 (PST) Sender: Ingo Molnar From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Shrikanth Hegde , Peter Zijlstra , Vincent Guittot , Dietmar Eggemann , Linus Torvalds , Valentin Schneider Subject: [PATCH 3/9] sched/balancing: Change 'enum cpu_idle_type' to have more natural definitions Date: Mon, 4 Mar 2024 10:48:25 +0100 Message-Id: <20240304094831.3639338-4-mingo@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240304094831.3639338-1-mingo@kernel.org> References: <20240304094831.3639338-1-mingo@kernel.org> 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" The cpu_idle_type enum has the confusingly inverted property that 'not idle' is 1, and 'idle' is '0'. This resulted in a number of unnecessary complications in the code. Reverse the order, remove the CPU_NOT_IDLE type, and convert all code to a natural boolean form. It's much more readable: - enum cpu_idle_type idle =3D this_rq->idle_balance ? - CPU_IDLE : CPU_NOT_IDLE; - + enum cpu_idle_type idle =3D this_rq->idle_balance; -------------------------------- - if (env->idle =3D=3D CPU_NOT_IDLE || !busiest->sum_nr_running) + if (!env->idle || !busiest->sum_nr_running) -------------------------------- And gets rid of the double negation in these usages: - if (env->idle !=3D CPU_NOT_IDLE && env->src_rq->nr_runnin= g <=3D 1) + if (env->idle && env->src_rq->nr_running <=3D 1) Furthermore, this makes code much more obvious where there's differentiation between CPU_IDLE and CPU_NEWLY_IDLE. Signed-off-by: Ingo Molnar Cc: Peter Zijlstra Cc: Vincent Guittot Cc: Dietmar Eggemann Cc: Linus Torvalds Cc: Valentin Schneider Reviewed-by: Valentin Schneider --- include/linux/sched/idle.h | 3 +-- kernel/sched/fair.c | 27 ++++++++++++--------------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/include/linux/sched/idle.h b/include/linux/sched/idle.h index 478084f9105e..4a6423700ffc 100644 --- a/include/linux/sched/idle.h +++ b/include/linux/sched/idle.h @@ -5,8 +5,7 @@ #include =20 enum cpu_idle_type { - CPU_IDLE, - CPU_NOT_IDLE, + CPU_IDLE =3D 1, CPU_NEWLY_IDLE, CPU_MAX_IDLE_TYPES }; diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 64ae3d8dc93b..f11fc6dd39b1 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9070,7 +9070,7 @@ static int detach_tasks(struct lb_env *env) * We don't want to steal all, otherwise we may be treated likewise, * which could at worst lead to a livelock crash. */ - if (env->idle !=3D CPU_NOT_IDLE && env->src_rq->nr_running <=3D 1) + if (env->idle && env->src_rq->nr_running <=3D 1) break; =20 env->loop++; @@ -9803,7 +9803,7 @@ static inline bool smt_vs_nonsmt_groups(struct sched_= group *sg1, static inline bool smt_balance(struct lb_env *env, struct sg_lb_stats *sgs, struct sched_group *group) { - if (env->idle =3D=3D CPU_NOT_IDLE) + if (!env->idle) return false; =20 /* @@ -9827,7 +9827,7 @@ static inline long sibling_imbalance(struct lb_env *e= nv, int ncores_busiest, ncores_local; long imbalance; =20 - if (env->idle =3D=3D CPU_NOT_IDLE || !busiest->sum_nr_running) + if (!env->idle || !busiest->sum_nr_running) return 0; =20 ncores_busiest =3D sds->busiest->cores; @@ -9927,8 +9927,7 @@ static inline void update_sg_lb_stats(struct lb_env *= env, sgs->group_misfit_task_load =3D rq->misfit_task_load; *sg_status |=3D SG_OVERLOAD; } - } else if ((env->idle !=3D CPU_NOT_IDLE) && - sched_reduced_capacity(rq, env->sd)) { + } else if (env->idle && sched_reduced_capacity(rq, env->sd)) { /* Check for a task running on a CPU with reduced capacity */ if (sgs->group_misfit_task_load < load) sgs->group_misfit_task_load =3D load; @@ -9940,7 +9939,7 @@ static inline void update_sg_lb_stats(struct lb_env *= env, sgs->group_weight =3D group->group_weight; =20 /* Check if dst CPU is idle and preferred to this group */ - if (!local_group && env->idle !=3D CPU_NOT_IDLE && sgs->sum_h_nr_running = && + if (!local_group && env->idle && sgs->sum_h_nr_running && sched_group_asym(env, sgs, group)) sgs->group_asym_packing =3D 1; =20 @@ -10698,7 +10697,7 @@ static inline void calculate_imbalance(struct lb_en= v *env, struct sd_lb_stats *s * waiting task in this overloaded busiest group. Let's * try to pull it. */ - if (env->idle !=3D CPU_NOT_IDLE && env->imbalance =3D=3D 0) { + if (env->idle && env->imbalance =3D=3D 0) { env->migration_type =3D migrate_task; env->imbalance =3D 1; } @@ -10913,7 +10912,7 @@ static struct sched_group *find_busiest_group(struc= t lb_env *env) goto force_balance; =20 if (busiest->group_type !=3D group_overloaded) { - if (env->idle =3D=3D CPU_NOT_IDLE) { + if (!env->idle) { /* * If the busiest group is not overloaded (and as a * result the local one too) but this CPU is already @@ -11121,7 +11120,7 @@ asym_active_balance(struct lb_env *env) * the lower priority @env::dst_cpu help it. Do not follow * CPU priority. */ - return env->idle !=3D CPU_NOT_IDLE && sched_use_asym_prio(env->sd, env->d= st_cpu) && + return env->idle && sched_use_asym_prio(env->sd, env->dst_cpu) && (sched_asym_prefer(env->dst_cpu, env->src_cpu) || !sched_use_asym_prio(env->sd, env->src_cpu)); } @@ -11159,7 +11158,7 @@ static int need_active_balance(struct lb_env *env) * because of other sched_class or IRQs if more capacity stays * available on dst_cpu. */ - if ((env->idle !=3D CPU_NOT_IDLE) && + if (env->idle && (env->src_rq->cfs.h_nr_running =3D=3D 1)) { if ((check_cpu_capacity(env->src_rq, sd)) && (capacity_of(env->src_cpu)*sd->imbalance_pct < capacity_of(env->dst_= cpu)*100)) @@ -11735,8 +11734,8 @@ static void rebalance_domains(struct rq *rq, enum c= pu_idle_type idle) * env->dst_cpu, so we can't know our idle * state even if we migrated tasks. Update it. */ - idle =3D idle_cpu(cpu) ? CPU_IDLE : CPU_NOT_IDLE; - busy =3D idle !=3D CPU_IDLE && !sched_idle_cpu(cpu); + idle =3D idle_cpu(cpu); + busy =3D !idle && !sched_idle_cpu(cpu); } sd->last_balance =3D jiffies; interval =3D get_sd_balance_interval(sd, busy); @@ -12416,9 +12415,7 @@ static int newidle_balance(struct rq *this_rq, stru= ct rq_flags *rf) static __latent_entropy void run_rebalance_domains(struct softirq_action *= h) { struct rq *this_rq =3D this_rq(); - enum cpu_idle_type idle =3D this_rq->idle_balance ? - CPU_IDLE : CPU_NOT_IDLE; - + enum cpu_idle_type idle =3D this_rq->idle_balance; /* * If this CPU has a pending nohz_balance_kick, then do the * balancing on behalf of the other idle CPUs whose ticks are --=20 2.40.1 From nobody Sun Feb 8 02:34:55 2026 Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) (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 13C7A225A2 for ; Mon, 4 Mar 2024 09:48:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709545729; cv=none; b=euitIx7i4q5mQX2mnCxXskJ+Gk3X/f3frYJ2q0+8tfyNU4iWzqkUgCR2xoItXIg7CAqmafWtY7uuygFSYAlN7HkDZGZQo5fv/v/L7aU97CfR/yritxTvGrP+SUkp1gAGSndIfdATkpPS1cv35rfgFfLgKYWx8XY2mDef/P6LjDk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709545729; c=relaxed/simple; bh=25qFObja4ZHXiwqUDbfSYr1EcpHvXYlwGZ9JseGR6EI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Ji/MXSXkhlVQUl3z/4pW7kh1XHi2YDETrHlKoiukvPc4HTW1wKh+VbHeTpxxlCaD3p56HNfto30LRC6yU9nPNJRuHlq7Vc4PVBxqMtnNCKWUDyQxXphtpmnqpHxZs4daT3HyaHDWJSnyF34aN0EJ1bBLnS5kTrcViIk0loYaI0o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=T3MRVr1b; arc=none smtp.client-ip=209.85.218.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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="T3MRVr1b" Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a3fb8b0b7acso551281566b.2 for ; Mon, 04 Mar 2024 01:48:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709545726; x=1710150526; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=m8fTQ+F8wbIR0pBCZ90+DSUH9EydgL03eONGv2AQpFQ=; b=T3MRVr1btKrUguAdiuNooYiB6ZAghYwKNCztLL45EfkoAtKdpuTtPI+mDGqgqw9flw xtp1XYQ4KCzsF43vcJsNik+uqAqgqHfFywlc54GzlSPRut6QsOXzSmYNz51PfyykqVlb EH6XgOvSH03zSeeR8IXC9Q2CZ/Mvix1GZlKAW5Jah73X3XyBVE1VeM7ofIC7tRhWrA1j oG+wdkH/hQw3/S+qiC7mWKepQN268kwt3RC0VwTno/q5K3FDxpe1alHDK9st0Xo6iUqW m+FNXuoCFsNPuoUFWSay1ikL9HVKWklruIg5+rS97q40qYxB8O3GyeujRpM2n1s8huV4 LE8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709545726; x=1710150526; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=m8fTQ+F8wbIR0pBCZ90+DSUH9EydgL03eONGv2AQpFQ=; b=FSPBmMEelH7wCiullRyJB4+BqT47E8hGm7aYTTfINVrjHhcfchHKBpzRQ24XYCLqbO 82K1a86+d6YItJP2zZpwE5YVcV+5xnVlz2VjSiiiO7AcQAF3eZxpjLXSHjo/2jQPOZP9 zbnrKDr/yddF2EnbGvadPXErVLgXjQCTz0eBFDyHM8HOvhzhpPiv894xv7xtvlJzKeb3 5kK4GZU6oI89KWxJSDqF2swnF5Acd8UqWSkU/eVgL1IMEPlLOy2OjijIipqp13RnytNW HCr7gFwb2ohaplvAq4qxmt6OXAkySff07UVjAeLMV3d0obAfYYGKnKcDU3JfSm2dn6Nh mu3Q== X-Gm-Message-State: AOJu0YwfV9Zly3Cr+yrgL5uko33F7a4/1W00NHWt3eTy6WYiBbluhsY2 ASyvLm+TUY6LhYZUk9hnTB9xpnBZB35gspKgXcJwnkM8J8kGydUTWow/MKu4dJk= X-Google-Smtp-Source: AGHT+IF1FsxSvOKuqOF2NT31Ibw7qOiTD8cI3Sr3moOY5rR9+7kSDHylbfkPUsEZBe1RzLQq99Ap5Q== X-Received: by 2002:a17:906:3642:b0:a45:122b:5637 with SMTP id r2-20020a170906364200b00a45122b5637mr2410198ejb.41.1709545726622; Mon, 04 Mar 2024 01:48:46 -0800 (PST) Received: from kepler.redhat.com (1F2EF13F.nat.pool.telekom.hu. [31.46.241.63]) by smtp.gmail.com with ESMTPSA id s22-20020a170906501600b00a42e2bc82dbsm4569839ejj.169.2024.03.04.01.48.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 01:48:46 -0800 (PST) Sender: Ingo Molnar From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Shrikanth Hegde , Peter Zijlstra , Vincent Guittot , Dietmar Eggemann , Linus Torvalds , Valentin Schneider Subject: [PATCH 4/9] sched/balancing: Change comment formatting to not overlap Git conflict marker lines Date: Mon, 4 Mar 2024 10:48:26 +0100 Message-Id: <20240304094831.3639338-5-mingo@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240304094831.3639338-1-mingo@kernel.org> References: <20240304094831.3639338-1-mingo@kernel.org> 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" So the scheduler has two such comment blocks, with '=3D' used as a double u= nderline: /* * VRUNTIME * =3D=3D=3D=3D=3D=3D=3D=3D * '=3D=3D=3D=3D=3D=3D=3D=3D' also happens to be a Git conflict marker, throwi= ng off a simple search in an editor for this pattern. Change them to '-------' type of underline instead - it looks just as good. Signed-off-by: Ingo Molnar Cc: Peter Zijlstra Cc: Vincent Guittot Cc: Dietmar Eggemann Cc: Linus Torvalds Cc: Valentin Schneider Reviewed-by: Valentin Schneider Reviewed-by: Vincent Guittot --- kernel/sched/fair.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index f11fc6dd39b1..934ace69eb30 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3679,7 +3679,7 @@ static void reweight_eevdf(struct cfs_rq *cfs_rq, str= uct sched_entity *se, =20 /* * VRUNTIME - * =3D=3D=3D=3D=3D=3D=3D=3D + * -------- * * COROLLARY #1: The virtual runtime of the entity needs to be * adjusted if re-weight at !0-lag point. @@ -3762,7 +3762,7 @@ static void reweight_eevdf(struct cfs_rq *cfs_rq, str= uct sched_entity *se, =20 /* * DEADLINE - * =3D=3D=3D=3D=3D=3D=3D=3D + * -------- * * When the weight changes, the virtual time slope changes and * we should adjust the relative virtual deadline accordingly. --=20 2.40.1 From nobody Sun Feb 8 02:34:55 2026 Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (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 783D725750 for ; Mon, 4 Mar 2024 09:48:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709545731; cv=none; b=maB7Y7J74az1OAldfMwjK8/cFp97oD3oc1DmEEoTEo5yVhdNbsk3L8xvXq7eKdc/bJirBzPCPgy/C+BjMW1Dx7elgLv/JKnm/3LZuexX2FeX/2DGnVSQE8pm38vheN+bzV0g4jCECFny88Mud4e2RqX6IhsKXYciVQycR5wk0BU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709545731; c=relaxed/simple; bh=MzMJY9/zgf5Oz86g7Hieae+K/U88BNmCb9J5ynGrUUk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=um5wek52Sfht0uu+OmSKI/Wht+N3w+FR9U04qiTtaJ9aHrbKPOysfQlfiR5Poxn2H5l0qmBfA/oxwjWQ9F2PlSLlhJrhu9hM0XFMbPFJWNFb3diTHADAxNuFUlHAqvOsJjUSRC7q2eBVMvL5C77XzNWH7j6WpkXH5lHBcIHXhgc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IpekwtjC; arc=none smtp.client-ip=209.85.208.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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="IpekwtjC" Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-5672afabb86so812663a12.3 for ; Mon, 04 Mar 2024 01:48:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709545728; x=1710150528; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=GyidcM4nXcEaVfVvwbOfTiXrFeqdSr6X/aGwmAepY54=; b=IpekwtjCpsKJZSp25TIKYofc1BjLVik0e3LlvD3c1SxFQaK/FNBwjc3jN+Gb0ldkMd +ErZe8cCEK/HFwmBdvuuyOribkh35u5ZE8zdTR9in+5ASiLPS3HrLOjsMQcFlBPnHfyZ WP6WTOWFxGjZ+133NvhJrf1G7wxoaeCOIx1b+PdGs4fLhzM5YVDrTkv4X46OEgVcHUcy iYliXS3y/zdMSmIEkr3gAJwq/2Jg9j07epuY6GfKLj3i3S2c/UmdRJ1lgnFg9L7zpZEj cigs6B5lumFsvHL3xoYxYyNzNcIK1PIG9xlpkOLf7AK/IcTlnV+S1jJStRBKyd8kyM6T hWPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709545728; x=1710150528; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=GyidcM4nXcEaVfVvwbOfTiXrFeqdSr6X/aGwmAepY54=; b=rmM/1Nve2gd481S6zU7pP/Dwywx1/hyY1qn3BTgbtFE54eFAx8WETp8Xj3/vo61tW1 b93UgvGJt+5/sgWPwTVECujoeZEEJ90suz0v7Go9NRuKTQVpbUvzv9mWv/GLuXkxirtZ bHm1Y+ibhOPuPGW5/0u3FLmPRbb0+1XRa4kI4lIkN5sczQeXhshamCjMmUdCk9xcn2TZ sciaBkSXEujxlK8XxGeM+TqLvLoklZwPgydvkKx+fKYFW9B5psD/W1AWx4CbCclWfdH2 gSDAMGc7hesmeVt7LHF6WAuDkcnu+HdgT4pyuyX5gpw/l93n2S/hGrodiPLIJm7Rf7WN Q6og== X-Gm-Message-State: AOJu0YySCAjhMV8ois7Q4OWnEuJH++SWOcmlVOKCBtsdK+dq6hsKnzL7 XcEV2ugoUWZ8rhhfPUow7IT08Lwsx+zHc7eHMx0d4cmtxhn9ioU1M4Wgj8Ajdk4= X-Google-Smtp-Source: AGHT+IGrWu7ee0LRPYL/ogLZoLapZyet5fE/pHJ0/OdMvcuuyaSKS29gsFHD7A6W/DvdQU2UBJTt5w== X-Received: by 2002:a17:906:d045:b0:a44:4d9b:9062 with SMTP id bo5-20020a170906d04500b00a444d9b9062mr4866205ejb.69.1709545727613; Mon, 04 Mar 2024 01:48:47 -0800 (PST) Received: from kepler.redhat.com (1F2EF13F.nat.pool.telekom.hu. [31.46.241.63]) by smtp.gmail.com with ESMTPSA id s22-20020a170906501600b00a42e2bc82dbsm4569839ejj.169.2024.03.04.01.48.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 01:48:47 -0800 (PST) Sender: Ingo Molnar From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Shrikanth Hegde , Peter Zijlstra , Vincent Guittot , Dietmar Eggemann , Linus Torvalds , Valentin Schneider Subject: [PATCH 5/9] sched/balancing: Fix comments (trying to) refer to NOHZ_BALANCE_KICK Date: Mon, 4 Mar 2024 10:48:27 +0100 Message-Id: <20240304094831.3639338-6-mingo@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240304094831.3639338-1-mingo@kernel.org> References: <20240304094831.3639338-1-mingo@kernel.org> 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" Fix two typos: - There's no such thing as 'nohz_balancing_kick', the flag is named 'BALANCE' and is capitalized: NOHZ_BALANCE_KICK. - Likewise there's no such thing as a 'pending nohz_balance_kick' either, the NOHZ_BALANCE_KICK flag is all upper-case. Signed-off-by: Ingo Molnar Cc: Peter Zijlstra Cc: Vincent Guittot Cc: Dietmar Eggemann Cc: Linus Torvalds Cc: Valentin Schneider Reviewed-by: Valentin Schneider --- kernel/sched/fair.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 934ace69eb30..4c46bffb6a7a 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -12410,14 +12410,14 @@ static int newidle_balance(struct rq *this_rq, st= ruct rq_flags *rf) =20 /* * run_rebalance_domains is triggered when needed from the scheduler tick. - * Also triggered for nohz idle balancing (with nohz_balancing_kick set). + * Also triggered for NOHZ idle balancing (with NOHZ_BALANCE_KICK set). */ static __latent_entropy void run_rebalance_domains(struct softirq_action *= h) { struct rq *this_rq =3D this_rq(); enum cpu_idle_type idle =3D this_rq->idle_balance; /* - * If this CPU has a pending nohz_balance_kick, then do the + * If this CPU has a pending NOHZ_BALANCE_KICK, then do the * balancing on behalf of the other idle CPUs whose ticks are * stopped. Do nohz_idle_balance *before* rebalance_domains to * give the idle CPUs a chance to load balance. Else we may --=20 2.40.1 From nobody Sun Feb 8 02:34:55 2026 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) (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 1A8452E417 for ; Mon, 4 Mar 2024 09:48:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709545731; cv=none; b=QAxSP+gp5Wl6KA3llXTU6Bc74t8Niyty0PV9bLUMO7WrRqX20MgfITUIVdEGw5CsJrb0IFa4qg/S4ZYVGqSztIb/D40qbTbcodjRewjMlSYTpCCMNJJbwoWRUrBaZihqXtxjtOGkUwaQYe2gvASoMm6grU1aTJ/U/FToucHz0lY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709545731; c=relaxed/simple; bh=H3dfBXEqvb28jdKvV+Cdvj0UO1ctCgFEa2CewBivLtA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JMvbvl43yD12wsLt44L9L0hVlf9D8B9LQYMRJHCXejGQ8eZAzXBMuQRnUx9Hv8NZ1iRMQghho4dxG3kuI63UeF952i0hfsLqCr6lKfM3ZnXlz7OpiQ13iv40mjUx7yUF3yKFtj6ASdgKQDYou8Y852eR2Tb0GTTiVkm02kXEjns= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=d4G+Wxmq; arc=none smtp.client-ip=209.85.208.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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="d4G+Wxmq" Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-55a5e7fa471so6023526a12.1 for ; Mon, 04 Mar 2024 01:48:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709545728; x=1710150528; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=sqR7nteE4ruQbqsw6BhW1LGgKQJj5d/ALkmGz5hjH+Y=; b=d4G+WxmqMg3beqd+PfR4o7lvYBTfL7bT//WmwnQe793IHxYzXHE/hLyCUOpG6GP5cq POAMokrsmPa+Zc2rDWuJKUZ1QGJPGB0Tbtr271KwT3V9uJN1gF8aBkm2V1eZr0wLALuk HVHChznsOzFYM0wCZlxgL428e3CbtA6F4uCM1ZsxQgjwes752arDNFFvhy4xvN1rCO3+ x6zXZS35qVZONLK5qz3BKnArzWR2trrTXcEKbjd8PKY+Tjdsj1qZwk8KKI/dl9PvYjNb GDu+JP2yXPSMM0vIGTpMs57gnaKxUzZU587pYSn8ubJuRcgwOOEnSkw7KytXT85Neb1i JX3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709545728; x=1710150528; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=sqR7nteE4ruQbqsw6BhW1LGgKQJj5d/ALkmGz5hjH+Y=; b=EEEqXTzGsnPV2CAv9iem4AmndKxNzIywc2xpr+wzOkm5CvcdBvDoFDf8V++LeJ3Nh5 qq34stXpju4Z3GaQ1PX5Oq4eNW/bZDgNMl28K6vYNxFW+u8ihBSMy5FhFkvcOD6FOhSg 95IBjA3dipX9buPW4Bkg8QYCeHLIsAS9r3FIhtGkcKOagj2DhUiA40ucqHfyNx3K7DiB TanM2iwvms/dZnaDNyCobl52QJ97nVUM91FYf5dyw5KYak6sZafIuEj4Ju7C06VyLG5E UGc4o4tQBlnpqq+BmPZops30QSrkQ6WylrHx/bq7kFU0QJ986pSsy5iRxpYVD2lMNYmF 2wCw== X-Gm-Message-State: AOJu0YzeM8VBZGTTpsw+BrEnDHKx/Hd5h55MaOD1UD+vTCQ9T6jfeFsq 2ARyHk4yAaHtqRGwXwF4W3YrbZMqTPus+l5qlgA9oy0YpsSN0/yr2u3qvgH8O9w= X-Google-Smtp-Source: AGHT+IEIb82ASF63g7U6cQk+RqNpM8swI2FcerhLv8ZKltonxWReDLw35KKTRPUiHVycIVvQz0QZwA== X-Received: by 2002:a17:906:19cf:b0:a43:ab98:d376 with SMTP id h15-20020a17090619cf00b00a43ab98d376mr6130002ejd.15.1709545728607; Mon, 04 Mar 2024 01:48:48 -0800 (PST) Received: from kepler.redhat.com (1F2EF13F.nat.pool.telekom.hu. [31.46.241.63]) by smtp.gmail.com with ESMTPSA id s22-20020a170906501600b00a42e2bc82dbsm4569839ejj.169.2024.03.04.01.48.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 01:48:48 -0800 (PST) Sender: Ingo Molnar From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Shrikanth Hegde , Peter Zijlstra , Vincent Guittot , Dietmar Eggemann , Linus Torvalds , Valentin Schneider Subject: [PATCH 6/9] sched/balancing: Update run_rebalance_domains() comments Date: Mon, 4 Mar 2024 10:48:28 +0100 Message-Id: <20240304094831.3639338-7-mingo@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240304094831.3639338-1-mingo@kernel.org> References: <20240304094831.3639338-1-mingo@kernel.org> 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" The first sentence of the comment explaining run_rebalance_domains() is historic and not true anymore: * run_rebalance_domains is triggered when needed from the scheduler tic= k. ... contradicted/modified by the second sentence: * Also triggered for NOHZ idle balancing (with NOHZ_BALANCE_KICK set). Avoid that kind of confusion straight away and explain from what places sched_balance_softirq() is triggered. Signed-off-by: Ingo Molnar Cc: Peter Zijlstra Cc: Vincent Guittot Cc: Dietmar Eggemann Cc: Linus Torvalds Cc: Valentin Schneider --- kernel/sched/fair.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 4c46bffb6a7a..18b7d2999cff 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -12409,8 +12409,13 @@ static int newidle_balance(struct rq *this_rq, str= uct rq_flags *rf) } =20 /* - * run_rebalance_domains is triggered when needed from the scheduler tick. - * Also triggered for NOHZ idle balancing (with NOHZ_BALANCE_KICK set). + * The run_rebalance_domains() softirq handler is triggered via SCHED_SOFT= IRQ + * from two places: + * + * - the scheduler_tick(), + * + * - from the SMP cross-call function nohz_csd_func(), + * used by NOHZ idle balancing (with NOHZ_BALANCE_KICK set). */ static __latent_entropy void run_rebalance_domains(struct softirq_action *= h) { --=20 2.40.1 From nobody Sun Feb 8 02:34:55 2026 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (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 2D052249F1 for ; Mon, 4 Mar 2024 09:48:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709545733; cv=none; b=qS/BcxueVmTamn2Jjd7upY3VBGUm5b0FkBz5x/+1/swL1DYSo7NmN/8LWokXXMrC58j/rcnRAvvNd4/CxaKum5dGA1QTguOvGdgJ6sIx2VTChk3MOndlVNTT0kNQ6atjS5ub1dY0yJ3VHKRge/lCB+KX/Zr1Pz1u+FghqXXnWto= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709545733; c=relaxed/simple; bh=gMQWIQDH7C8bNgMKp71YfGIO8qskGuiF8UVttyGNS/s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VY2cUjoLMjp1DQPDz8jIgeFy9DZ5lx9fkIfTkJBZTMA5dDTW40RdoKJ8jhchtliEwLvg6S6VfOpTOSgy5b/tnv0RreGAk2TX7cQepRzUwayHbgBUeYJVv//whmWp6jer8/FyAQEXadx2pfc5pL0o8d4MZs2bLnBxO0JyS52gsQo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JMIuax/L; arc=none smtp.client-ip=209.85.218.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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="JMIuax/L" Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a44e3176120so171965566b.1 for ; Mon, 04 Mar 2024 01:48:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709545729; x=1710150529; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=sBHue8vJcmz9qFDlC9AIElMkx8kDde5GI/q8mPS7dVg=; b=JMIuax/LDBQ7VYyOu7dCBSjaz4WA58e4XLpKm0UYeFG0XhxUbItyds/+FeWLkY7269 /4CcPrf7sTFKPUX3WGvyGtK4rIzK3EQETOqGz9yWod0Zi37NkmuXtCJ6YCmcYRs4fV/T mKfx8mo6h9vFYpy6G04DsO67VFqMGSgwQr5Z1A6RoAGjLYwIZDVGXlL2S4sCasVS6qPh 5V5q5+1HKvSDFqolNyBW4/Den62JfcvAXv0Hhl7bi2V/IF1yYnk12lZGdYrUNcbO0UTs 5ApFIcglSpwKo7W0riXNzjbFqmn7HbLcodq8g0mZq4I4vAL08wQY0+Yf/cALmCcOcvOf Gc1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709545729; x=1710150529; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=sBHue8vJcmz9qFDlC9AIElMkx8kDde5GI/q8mPS7dVg=; b=iX/rCkrO8Fd8BadYvLGV/SpKQHx0RGMHAzyiNwZITw0ZdCLI7pLE500bEuKnHzQl9A k4a18995kscTd4uGa+rrZlEmxXXKXaQpLtwnB47Cqw1VSWlZF0j+AyRDfcDduW0ev1ud wRGjQHCozfHuQgA7yEEJHOSTshqg2qSn4+jAl8BaXsLrWRcpMb573yY/QwPU9rZH6EVp ypsYW85GL3q1x4PkjE1UEb9B7F35nKKdgwFkpmFsDBJa9+BDJ7lw/YFErMQrDWxB+coA ykK5vERv4UNdS6+0ocVUaedmg87Cqnl01Y3tMaXEkOTcgrbX2g5oDSW0HurArglhVJNV LubQ== X-Gm-Message-State: AOJu0YxeASBgVJp0YDq9Xb19vdrUA/baNnG5vzdUsuqW2BibKgHh1W2X CalFBHtBUOxD10mnppz3/rOR4xc+HHOE1q6sbU/wXPSpghNevm+41dZTtxTFGiQ= X-Google-Smtp-Source: AGHT+IFiVm1lZuNk09qzx0SI9MkhxwhhzZrt8l8A9lGkk40fmR8uIIcUEINTDaScq3lXPk8C5H3ZOA== X-Received: by 2002:a17:906:f35b:b0:a43:fb64:e21d with SMTP id hg27-20020a170906f35b00b00a43fb64e21dmr6699556ejb.7.1709545729583; Mon, 04 Mar 2024 01:48:49 -0800 (PST) Received: from kepler.redhat.com (1F2EF13F.nat.pool.telekom.hu. [31.46.241.63]) by smtp.gmail.com with ESMTPSA id s22-20020a170906501600b00a42e2bc82dbsm4569839ejj.169.2024.03.04.01.48.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 01:48:49 -0800 (PST) Sender: Ingo Molnar From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Shrikanth Hegde , Peter Zijlstra , Vincent Guittot , Dietmar Eggemann , Linus Torvalds , Valentin Schneider Subject: [PATCH 7/9] sched/balancing: Vertically align the comments of 'struct sg_lb_stats' and 'struct sd_lb_stats' Date: Mon, 4 Mar 2024 10:48:29 +0100 Message-Id: <20240304094831.3639338-8-mingo@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240304094831.3639338-1-mingo@kernel.org> References: <20240304094831.3639338-1-mingo@kernel.org> 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" Make them easier to read. Signed-off-by: Ingo Molnar Cc: Peter Zijlstra Cc: Vincent Guittot Cc: Dietmar Eggemann Cc: Linus Torvalds Cc: Valentin Schneider Reviewed-by: Valentin Schneider --- kernel/sched/fair.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 18b7d2999cff..fc4b2df7ddf2 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9436,19 +9436,19 @@ static void update_blocked_averages(int cpu) * sg_lb_stats - stats of a sched_group required for load_balancing */ struct sg_lb_stats { - unsigned long avg_load; /*Avg load across the CPUs of the group */ - unsigned long group_load; /* Total load over the CPUs of the group */ + unsigned long avg_load; /* Avg load across the CPUs of the group */ + unsigned long group_load; /* Total load over the CPUs of the group */ unsigned long group_capacity; - unsigned long group_util; /* Total utilization over the CPUs of the group= */ - unsigned long group_runnable; /* Total runnable time over the CPUs of the= group */ - unsigned int sum_nr_running; /* Nr of tasks running in the group */ - unsigned int sum_h_nr_running; /* Nr of CFS tasks running in the group */ + unsigned long group_util; /* Total utilization over the CPUs of the grou= p */ + unsigned long group_runnable; /* Total runnable time over the CPUs of th= e group */ + unsigned int sum_nr_running; /* Nr of tasks running in the group */ + unsigned int sum_h_nr_running; /* Nr of CFS tasks running in the group */ unsigned int idle_cpus; unsigned int group_weight; enum group_type group_type; - unsigned int group_asym_packing; /* Tasks should be moved to preferred CP= U */ - unsigned int group_smt_balance; /* Task on busy SMT be moved */ - unsigned long group_misfit_task_load; /* A CPU has a task too big for its= capacity */ + unsigned int group_asym_packing; /* Tasks should be moved to preferred CP= U */ + unsigned int group_smt_balance; /* Task on busy SMT be moved */ + unsigned long group_misfit_task_load; /* A CPU has a task too big for its= capacity */ #ifdef CONFIG_NUMA_BALANCING unsigned int nr_numa_running; unsigned int nr_preferred_running; @@ -9460,15 +9460,15 @@ struct sg_lb_stats { * during load balancing. */ struct sd_lb_stats { - struct sched_group *busiest; /* Busiest group in this sd */ - struct sched_group *local; /* Local group in this sd */ - unsigned long total_load; /* Total load of all groups in sd */ - unsigned long total_capacity; /* Total capacity of all groups in sd */ - unsigned long avg_load; /* Average load across all groups in sd */ - unsigned int prefer_sibling; /* tasks should go to sibling first */ + struct sched_group *busiest; /* Busiest group in this sd */ + struct sched_group *local; /* Local group in this sd */ + unsigned long total_load; /* Total load of all groups in sd */ + unsigned long total_capacity; /* Total capacity of all groups in sd */ + unsigned long avg_load; /* Average load across all groups in sd */ + unsigned int prefer_sibling; /* tasks should go to sibling first */ =20 - struct sg_lb_stats busiest_stat;/* Statistics of the busiest group */ - struct sg_lb_stats local_stat; /* Statistics of the local group */ + struct sg_lb_stats busiest_stat; /* Statistics of the busiest group */ + struct sg_lb_stats local_stat; /* Statistics of the local group */ }; =20 static inline void init_sd_lb_stats(struct sd_lb_stats *sds) --=20 2.40.1 From nobody Sun Feb 8 02:34:55 2026 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (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 D3FE4376F7 for ; Mon, 4 Mar 2024 09:48:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709545734; cv=none; b=O5JBahLZ+DF2QutSc7sNeK4m30con9VeQCbn8uin3aAYbI7A48p7ypMvMOcUxYetxqC0LNcAyBpoY6R7lZI3kP5dby6hk8z5SWXQIBp5b5n3YJu/2a6FvPotWPQIgcVSjSdBkyVJ058n4tz6SpbwfeOXXTuNVVIPAVgvU/yQmco= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709545734; c=relaxed/simple; bh=5q4oEyd8gvew6IIC9Mzd7ppJ4jXjtnRcQTUuMhWmx0Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=W+tjDeaWERFmU07f3+ga9UGUbc5401nwnN5JSCvWcyeQfpORvES4g1+9iDAvA54dqit2fLXEKSLwKTUchqdstbiBRs0GncIGtNk1FUfXr3N/b7ZW33UWBGlL1pogWFMOf9M5VgaRkx2e71SubT7ACLpX2K3cfoIfXncNihgPoU8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RVE9sAto; arc=none smtp.client-ip=209.85.218.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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="RVE9sAto" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a452877ddcaso107787166b.3 for ; Mon, 04 Mar 2024 01:48:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709545731; x=1710150531; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=XNOPsWtOzHmhyJLPA4H5Sikwc9camJCP2VR8Yk1oBD8=; b=RVE9sAtoD82SWvKSCdKRsDZOE9etGwaEbt5Ci8aQdN5LAIQJ4QVzkoA4brMhUZrwd+ dHfLbvxaGjyMtRpOukzK9wiSiXxtbZY80RFaiRnnOkDPS79K8gyPJlkgpqG1/C81Ewij 4qxw1Cxby/DtHUvNZRss3xUc/OnglVoikAdAorZMidvc7b+DGw/1vmU3evazp9Ih37th KhX1psyp9C2tN8Gid0O6W5Lab7sGoMxnSbsSsOxdTpu1jXAcphkCtl3kkCNwiGj58wjs eOggwt5r646r+bcohhhbQnKWPy74OYMsaNqd7FM22Og3ZlIbyTc8Rta++svgx+YO7FUG +xjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709545731; x=1710150531; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=XNOPsWtOzHmhyJLPA4H5Sikwc9camJCP2VR8Yk1oBD8=; b=qxA2qociFxO0B9wq4CIciZv05Xx0oj2n69G025Dc2xyGSIKdnvLVEKXVh98EBl3HL+ 5f8MrHuNMC1oi0gOKeZELpLPTrAqXMa983CMpnUjOcxjCv0zAHA8DpIxwsd5nt7eMDDc bVVeiDRQEj6sU4T+oclBSg61zwR9jtCtO+d1ATb7XG0T8oVuDJSUb9XtCgm+ih+ExZ2s qgZqsLGWNvkCh/GMRh0mU4Ra4weWl7oqxk5Y0nJgWwhYKcgSmtPkNsPRDWL9zliFCTTx ocdoflVpEq8CvqGi0sUwmxyqrIFmD5daGRxLnuhtp/4/6lASjH1ZHmoYP6q0E+L54vrs TwUg== X-Gm-Message-State: AOJu0YwZpiHIRrpf5U5gD6928bQHSM8CHuUNL6O3WTtykJKdB1C0THA5 +gmKjJiuhRz5rGQKaDUNO2SNsTHRH8wcI2T8fmNFdusFmtyDqPH3CSpmmZb7/w4= X-Google-Smtp-Source: AGHT+IHLcHDtBKBKDPD5G3XyH0bgIbP85i9nC7qxzLNV0qSA4YXmeadC79OyG807zrHN7QrKbVxc5w== X-Received: by 2002:a17:906:349a:b0:a45:214b:73cb with SMTP id g26-20020a170906349a00b00a45214b73cbmr2116320ejb.36.1709545731205; Mon, 04 Mar 2024 01:48:51 -0800 (PST) Received: from kepler.redhat.com (1F2EF13F.nat.pool.telekom.hu. [31.46.241.63]) by smtp.gmail.com with ESMTPSA id s22-20020a170906501600b00a42e2bc82dbsm4569839ejj.169.2024.03.04.01.48.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 01:48:50 -0800 (PST) Sender: Ingo Molnar From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Shrikanth Hegde , Peter Zijlstra , Vincent Guittot , Dietmar Eggemann , Linus Torvalds , Valentin Schneider Subject: [PATCH 8/9] sched/balancing: Update comments in 'struct sg_lb_stats' and 'struct sd_lb_stats' Date: Mon, 4 Mar 2024 10:48:30 +0100 Message-Id: <20240304094831.3639338-9-mingo@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240304094831.3639338-1-mingo@kernel.org> References: <20240304094831.3639338-1-mingo@kernel.org> 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" - Align for readability - Capitalize consistently Signed-off-by: Ingo Molnar Cc: Peter Zijlstra Cc: Vincent Guittot Cc: Dietmar Eggemann Cc: Linus Torvalds Cc: Valentin Schneider Reviewed-by: Valentin Schneider --- kernel/sched/fair.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index fc4b2df7ddf2..0eb2cafa1509 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9433,17 +9433,17 @@ static void update_blocked_averages(int cpu) /********** Helpers for find_busiest_group ************************/ =20 /* - * sg_lb_stats - stats of a sched_group required for load_balancing + * sg_lb_stats - stats of a sched_group required for load-balancing: */ struct sg_lb_stats { - unsigned long avg_load; /* Avg load across the CPUs of the group */ - unsigned long group_load; /* Total load over the CPUs of the group */ - unsigned long group_capacity; - unsigned long group_util; /* Total utilization over the CPUs of the grou= p */ + unsigned long avg_load; /* Avg load over the CPUs of the gro= up */ + unsigned long group_load; /* Total load over the CPUs of the gr= oup */ + unsigned long group_capacity; /* Capacity over the CPUs of th= e group */ + unsigned long group_util; /* Total utilization over the CPUs of the gr= oup */ unsigned long group_runnable; /* Total runnable time over the CPUs of th= e group */ - unsigned int sum_nr_running; /* Nr of tasks running in the group */ + unsigned int sum_nr_running; /* Nr of all tasks running in the group */ unsigned int sum_h_nr_running; /* Nr of CFS tasks running in the group */ - unsigned int idle_cpus; + unsigned int idle_cpus; /* Nr of idle CPUs in the= group */ unsigned int group_weight; enum group_type group_type; unsigned int group_asym_packing; /* Tasks should be moved to preferred CP= U */ @@ -9456,8 +9456,7 @@ struct sg_lb_stats { }; =20 /* - * sd_lb_stats - Structure to store the statistics of a sched_domain - * during load balancing. + * sd_lb_stats - stats of a sched_domain required for load-balancing: */ struct sd_lb_stats { struct sched_group *busiest; /* Busiest group in this sd */ @@ -9465,7 +9464,7 @@ struct sd_lb_stats { unsigned long total_load; /* Total load of all groups in sd */ unsigned long total_capacity; /* Total capacity of all groups in sd */ unsigned long avg_load; /* Average load across all groups in sd */ - unsigned int prefer_sibling; /* tasks should go to sibling first */ + unsigned int prefer_sibling; /* Tasks should go to sibling first */ =20 struct sg_lb_stats busiest_stat; /* Statistics of the busiest group */ struct sg_lb_stats local_stat; /* Statistics of the local group */ --=20 2.40.1 From nobody Sun Feb 8 02:34:55 2026 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (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 06BE93839F for ; Mon, 4 Mar 2024 09:48:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709545735; cv=none; b=BE7D6Raad1ajVTJ8BK8ctO68xRaDEwkZFgtYZ2tGunM0o94mc3KOCW9OC9giKXyMSR7gRWP4BpiL2yFwzTZW8imTUDh95X0/R+TmDJFjEylRme3spgSpdlda8WcXgkrDJ5APWmT9kYwqzsAPCscMOQc+5iyh9xTT93c0QAHGfzA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709545735; c=relaxed/simple; bh=vdGrZwaI/Ookkfx04vBorgAmg1RU8pL6JYSXfdzQ9PY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=CDS5yVtvuUXj70p6fRLPx+vOElRCTcu1Cd4Htbx3M9cP2LXTSRtnUD2PPIIJbrFHUNmWw37TsObY/DuruxCpg75JiBEIrV0AmOLTvFYIWytrj2eY4g0+ANeA5xputcGG+hL9xZnA00GyeJ/pe80qJiIjoAzmsyJtfbU4m0WmVLM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gOL1eoRB; arc=none smtp.client-ip=209.85.218.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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="gOL1eoRB" Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a28a6cef709so689876766b.1 for ; Mon, 04 Mar 2024 01:48:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709545732; x=1710150532; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=eaJ13RYdVXWmZbDkVn4tVEtiI++AgEDK8GYib1p9JJ0=; b=gOL1eoRBVB2dUVJHDflLCwkLxEXuc0M+wNx0qTrFP5kx6eyHI66SOj9fw1D9AGknAR tKz/GKOmQuFpccgXUbRAsXQ7baqKpyOylLQXPmtz8hv1n/RKQGBhqv1mHdh1IZ42iIJX qHcS+nFyYAgViyI1v8hA/Pdqt0YKaIhu31VTbtf3FKuJGMows5bDTQAeagEa9OnoXYbn qyiaOaG3WrRP9fbqwHVSp7k5xC+RWJyA49o5VYKkFRsvwppD9WUZt5jGXoXU6BuGsAI2 695NDOPPOcNMzmLhj/lxpaaI2CCneQ95OhQSxRaomXpVcuscNrcX1BiatwbNM2bs29bf ZBZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709545732; x=1710150532; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=eaJ13RYdVXWmZbDkVn4tVEtiI++AgEDK8GYib1p9JJ0=; b=htubOOkW/SxVu4cN+wHmcoItNWCj1+tow/1nEJ1XlVvz7KxpAkxgzACo6fiGKLpKrY 4SjygF63bDLuFN3Gh5UohZ6RFKU2LkmIB6K6e2dGvA0Ac5GTjH/k2dfFV/chNvDgGax3 MrH4R2qTOkaoEJif/HGboDCEhb/w/MwT7Po+lA8/QWdjrNFGz7vDnPDxeYHLRyyL3Ti5 v0B5PS4KGFUPzn7rtJS0loD+1f1eJZPkfbRfFN7AWYl7pWY6lgneYLtvuPqeNjX5AztU gNXTy3pwnzf0W+soS3hmI6IHXe14/ucK/iyBVyXJpB26GfCdKLFbMrdKuKdskiPYruYD xIrQ== X-Gm-Message-State: AOJu0YypeAy36Tg1dhtIrmcdxJvsaQ7hv1GBpSmvmrAg56HOmLRQs9ae L3wVsi1sKAfa6FXlt+XRPdktbE9KOyaBSAlIaft+zKSePEIYpoAVIsjEKeRLWFQ= X-Google-Smtp-Source: AGHT+IH6YqqEJKxD+XyOyFPhadLbYTSOXX1KeuXfpxyOUnOXhPuYTKnbKZYpveSWNXLdWl+VNgHj7w== X-Received: by 2002:a17:906:48c6:b0:a45:2038:4caa with SMTP id d6-20020a17090648c600b00a4520384caamr2023252ejt.76.1709545732374; Mon, 04 Mar 2024 01:48:52 -0800 (PST) Received: from kepler.redhat.com (1F2EF13F.nat.pool.telekom.hu. [31.46.241.63]) by smtp.gmail.com with ESMTPSA id s22-20020a170906501600b00a42e2bc82dbsm4569839ejj.169.2024.03.04.01.48.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 01:48:51 -0800 (PST) Sender: Ingo Molnar From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Shrikanth Hegde , Peter Zijlstra , Vincent Guittot , Dietmar Eggemann , Linus Torvalds , Valentin Schneider Subject: [PATCH 9/9] sched/balancing: Rename run_rebalance_domains() => sched_balance_softirq() Date: Mon, 4 Mar 2024 10:48:31 +0100 Message-Id: <20240304094831.3639338-10-mingo@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240304094831.3639338-1-mingo@kernel.org> References: <20240304094831.3639338-1-mingo@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable run_rebalance_domains() is a misnomer, as it doesn't only run rebalance_domains(), but since the introduction of the NOHZ code it also runs nohz_idle_balance(). Rename it to sched_balance_softirq(), reflecting its more generic purpose and that it's a softirq handler. Signed-off-by: Ingo Molnar Cc: Peter Zijlstra Cc: Vincent Guittot Cc: Dietmar Eggemann Cc: Linus Torvalds Cc: Valentin Schneider Acked-by: Valentin Schneider --- Documentation/scheduler/sched-domains.rst | 2 +- Documentation/translations/zh_CN/scheduler/sched-domains.rst | 2 +- kernel/sched/fair.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/scheduler/sched-domains.rst b/Documentation/sche= duler/sched-domains.rst index e57ad28301bd..6577b068f921 100644 --- a/Documentation/scheduler/sched-domains.rst +++ b/Documentation/scheduler/sched-domains.rst @@ -34,7 +34,7 @@ out of balance are tasks moved between groups. In kernel/sched/core.c, trigger_load_balance() is run periodically on each= CPU through scheduler_tick(). It raises a softirq after the next regularly sch= eduled rebalancing event for the current runqueue has arrived. The actual load -balancing workhorse, run_rebalance_domains()->rebalance_domains(), is then= run +balancing workhorse, sched_balance_softirq()->rebalance_domains(), is then= run in softirq context (SCHED_SOFTIRQ). =20 The latter function takes two arguments: the runqueue of current CPU and w= hether diff --git a/Documentation/translations/zh_CN/scheduler/sched-domains.rst b= /Documentation/translations/zh_CN/scheduler/sched-domains.rst index e814d4c01141..fbc326668e37 100644 --- a/Documentation/translations/zh_CN/scheduler/sched-domains.rst +++ b/Documentation/translations/zh_CN/scheduler/sched-domains.rst @@ -36,7 +36,7 @@ CPU=E5=85=B1=E4=BA=AB=E3=80=82=E4=BB=BB=E6=84=8F=E4=B8=A4= =E4=B8=AA=E7=BB=84=E7=9A=84CPU=E6=8E=A9=E7=A0=81=E7=9A=84=E4=BA=A4=E9=9B=86= =E4=B8=8D=E4=B8=80=E5=AE=9A=E4=B8=BA=E7=A9=BA=EF=BC=8C=E5=A6=82=E6=9E=9C=E6= =98=AF=E8=BF=99 =20 =E5=9C=A8kernel/sched/core.c=E4=B8=AD=EF=BC=8Ctrigger_load_balance()=E5=9C= =A8=E6=AF=8F=E4=B8=AACPU=E4=B8=8A=E9=80=9A=E8=BF=87scheduler_tick() =E5=91=A8=E6=9C=9F=E6=89=A7=E8=A1=8C=E3=80=82=E5=9C=A8=E5=BD=93=E5=89=8D= =E8=BF=90=E8=A1=8C=E9=98=9F=E5=88=97=E4=B8=8B=E4=B8=80=E4=B8=AA=E5=AE=9A=E6= =9C=9F=E8=B0=83=E5=BA=A6=E5=86=8D=E5=B9=B3=E8=A1=A1=E4=BA=8B=E4=BB=B6=E5=88= =B0=E8=BE=BE=E5=90=8E=EF=BC=8C=E5=AE=83=E5=BC=95=E5=8F=91=E4=B8=80=E4=B8=AA= =E8=BD=AF=E4=B8=AD=E6=96=AD=E3=80=82=E8=B4=9F=E8=BD=BD=E5=9D=87=E8=A1=A1=E7= =9C=9F=E6=AD=A3 -=E7=9A=84=E5=B7=A5=E4=BD=9C=E7=94=B1run_rebalance_domains()->rebalance_dom= ains()=E5=AE=8C=E6=88=90=EF=BC=8C=E5=9C=A8=E8=BD=AF=E4=B8=AD=E6=96=AD=E4=B8= =8A=E4=B8=8B=E6=96=87=E4=B8=AD=E6=89=A7=E8=A1=8C +=E7=9A=84=E5=B7=A5=E4=BD=9C=E7=94=B1sched_balance_softirq()->rebalance_dom= ains()=E5=AE=8C=E6=88=90=EF=BC=8C=E5=9C=A8=E8=BD=AF=E4=B8=AD=E6=96=AD=E4=B8= =8A=E4=B8=8B=E6=96=87=E4=B8=AD=E6=89=A7=E8=A1=8C =EF=BC=88SCHED_SOFTIRQ=EF=BC=89=E3=80=82 =20 =E5=90=8E=E4=B8=80=E4=B8=AA=E5=87=BD=E6=95=B0=E6=9C=89=E4=B8=A4=E4=B8=AA= =E5=85=A5=E5=8F=82=EF=BC=9A=E5=BD=93=E5=89=8DCPU=E7=9A=84=E8=BF=90=E8=A1=8C= =E9=98=9F=E5=88=97=E3=80=81=E5=AE=83=E5=9C=A8scheduler_tick()=E8=B0=83=E7= =94=A8=E6=97=B6=E6=98=AF=E5=90=A6=E7=A9=BA=E9=97=B2=E3=80=82=E5=87=BD=E6=95= =B0=E4=BC=9A=E4=BB=8E diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 0eb2cafa1509..cdf0dbb9d3e3 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -12408,7 +12408,7 @@ static int newidle_balance(struct rq *this_rq, stru= ct rq_flags *rf) } =20 /* - * The run_rebalance_domains() softirq handler is triggered via SCHED_SOFT= IRQ + * The sched_balance_softirq() softirq handler is triggered via SCHED_SOFT= IRQ * from two places: * * - the scheduler_tick(), @@ -12416,7 +12416,7 @@ static int newidle_balance(struct rq *this_rq, stru= ct rq_flags *rf) * - from the SMP cross-call function nohz_csd_func(), * used by NOHZ idle balancing (with NOHZ_BALANCE_KICK set). */ -static __latent_entropy void run_rebalance_domains(struct softirq_action *= h) +static __latent_entropy void sched_balance_softirq(struct softirq_action *= h) { struct rq *this_rq =3D this_rq(); enum cpu_idle_type idle =3D this_rq->idle_balance; @@ -13217,7 +13217,7 @@ __init void init_sched_fair_class(void) #endif } =20 - open_softirq(SCHED_SOFTIRQ, run_rebalance_domains); + open_softirq(SCHED_SOFTIRQ, sched_balance_softirq); =20 #ifdef CONFIG_NO_HZ_COMMON nohz.next_balance =3D jiffies; --=20 2.40.1