lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20260114132531.19599-1-zhanxusheng@xiaomi.com>
Date: Wed, 14 Jan 2026 21:25:31 +0800
From: Zhan Xusheng <zhanxusheng1024@...il.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...nel.org>,
	linux-sched@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Zhan Xusheng <zhanxusheng@...omi.com>
Subject: [PATCH] sched/fair: clarify init_entity_runnable_average comment

The comment in init_entity_runnable_average() uses vague terms such as
"full load" and "heavy tasks", and does not clearly describe how group
entities are initialized.

Clarify that task entities are initialized with their scaled weight so
they are initially considered heavy until PELT converges to the actual
load, while group entities remain zero-initialized until tasks are
attached.

This makes the comment more precise and consistent with the code.

Signed-off-by: Zhan Xusheng <zhanxusheng@...omi.com>
---
 kernel/sched/fair.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index e71302282671..99c22863f3b8 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1060,10 +1060,14 @@ void init_entity_runnable_average(struct sched_entity *se)
 	memset(sa, 0, sizeof(*sa));
 
 	/*
-	 * Tasks are initialized with full load to be seen as heavy tasks until
-	 * they get a chance to stabilize to their real load level.
-	 * Group entities are initialized with zero load to reflect the fact that
-	 * nothing has been attached to the task group yet.
+	 * Initialize runnable average for a new sched_entity.
+	 *
+	 * - Ordinary tasks (entity_is_task) are initialized with their
+	 *   scaled load weight so that they are initially considered "heavy"
+	 *   by the scheduler, until PELT smoothing adjusts them to the actual load.
+	 *
+	 * - Group entities (task groups) remain at zero load since no tasks
+	 *   have been attached yet; their load will grow as tasks are added.
 	 */
 	if (entity_is_task(se))
 		sa->load_avg = scale_load_down(se->load.weight);
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ