[PATCH 0/2] Cleanup and Fix for wrong accounting of migrated cache hot tasks

From: Swapnil Sapkal
Date: Wed Jun 14 2023 - 06:26:53 EST


In /proc/schedstat, lb_hot_gained reports the number of times cache-hot
tasks were migrated as a part of load balancing. This value is incremented
in can_migrate_task() if the task is cache hot and migratable. But after
incrementing this value, it is possible that the task won't get migrated,
in which case this value will be incorrect. Fix this by incrementing it
in detach_task().

While at it, cleanup migrate_degrades_locality() by making it return
an enum instead of the {-1,0,1} to improve the readability of
can_migrate_task().

Swapnil Sapkal (2):
sched/fair: Fix value reported by hot tasks pulled in /proc/schedstat
sched/fair: Cleanup in migrate_degrades_locality() to improve
readability

kernel/sched/fair.c | 100 +++++++++++++++++++++++++++++---------------
1 file changed, 66 insertions(+), 34 deletions(-)

--
2.34.1