]> www.infradead.org Git - users/jedix/linux-maple.git/commit
sched/fair: Fix value reported by hot tasks pulled in /proc/schedstat
authorPeter Zijlstra <peterz@infradead.org>
Fri, 20 Dec 2024 06:32:19 +0000 (06:32 +0000)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 20 Dec 2024 14:31:16 +0000 (15:31 +0100)
commita430d99e349026d53e2557b7b22bd2ebd61fe12a
treeaf02450bc52ce9dfce37aee8ea11f5d8f9eb9520
parentee8118c1f1864eab709fb660d3af8545cf11ae96
sched/fair: Fix value reported by hot tasks pulled in /proc/schedstat

In /proc/schedstat, lb_hot_gained reports the number hot tasks pulled
during load balance. This value is incremented in can_migrate_task()
if the task is migratable and hot. After incrementing the value,
load balancer can still decide not to migrate this task leading to wrong
accounting. Fix this by incrementing stats when hot tasks are detached.
This issue only exists in detach_tasks() where we can decide to not
migrate hot task even if it is migratable. However, in detach_one_task(),
we migrate it unconditionally.

[Swapnil: Handled the case where nr_failed_migrations_hot was not accounted properly and wrote commit log]

Fixes: d31980846f96 ("sched: Move up affinity check to mitigate useless redoing overhead")
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reported-by: "Gautham R. Shenoy" <gautham.shenoy@amd.com>
Not-yet-signed-off-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Swapnil Sapkal <swapnil.sapkal@amd.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20241220063224.17767-2-swapnil.sapkal@amd.com
include/linux/sched.h
kernel/sched/fair.c