Commit a430d99e authored by Peter Zijlstra's avatar Peter Zijlstra
Browse files

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: d3198084 ("sched: Move up affinity check to mitigate useless redoing overhead")
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Reported-by: default avatar"Gautham R. Shenoy" <gautham.shenoy@amd.com>
Not-yet-signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
Signed-off-by: default avatarSwapnil Sapkal <swapnil.sapkal@amd.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20241220063224.17767-2-swapnil.sapkal@amd.com
parent ee8118c1
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment