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

Message ID 20230614102224.12555-1-swapnil.sapkal@amd.com
Headers
Series Cleanup and Fix for wrong accounting of migrated cache hot tasks |

Message

Swapnil Sapkal June 14, 2023, 10:22 a.m. UTC
  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(-)