From 0b3a7df78d7ab645cc96b5771c8710701bbb3282 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 6 Mar 2025 06:07:31 +0000 Subject: [PATCH] Revert "sched/fair: Fix value reported by hot tasks pulled in /proc/schedstat" This reverts commit a18682ccd2ec97e55f5a2c210b3bd2b4b7940a15 which is commit a430d99e349026d53e2557b7b22bd2ebd61fe12a upstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: Ia71eb1867950bae93b6c426a596d584716137b29 Signed-off-by: Greg Kroah-Hartman --- include/linux/sched.h | 1 - kernel/sched/fair.c | 17 ++++------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index c35dbd51cbcf..f9b69056809d 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -900,7 +900,6 @@ struct task_struct { unsigned sched_reset_on_fork:1; unsigned sched_contributes_to_load:1; unsigned sched_migrated:1; - unsigned sched_task_hot:1; /* Force alignment to the next boundary: */ unsigned :0; diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index eff3030debbc..e17d0efd09a7 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8425,8 +8425,6 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env) int can_migrate = 1; lockdep_assert_rq_held(env->src_rq); - if (p->sched_task_hot) - p->sched_task_hot = 0; trace_android_rvh_can_migrate_task(p, env->dst_cpu, &can_migrate); if (!can_migrate) @@ -8503,8 +8501,10 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env) if (tsk_cache_hot <= 0 || env->sd->nr_balance_failed > env->sd->cache_nice_tries) { - if (tsk_cache_hot == 1) - p->sched_task_hot = 1; + if (tsk_cache_hot == 1) { + schedstat_inc(env->sd->lb_hot_gained[env->idle]); + schedstat_inc(p->stats.nr_forced_migrations); + } return 1; } @@ -8531,12 +8531,6 @@ static void detach_task(struct task_struct *p, struct lb_env *env) if (detached) return; - if (p->sched_task_hot) { - p->sched_task_hot = 0; - schedstat_inc(env->sd->lb_hot_gained[env->idle]); - schedstat_inc(p->stats.nr_forced_migrations); - } - deactivate_task(env->src_rq, p, DEQUEUE_NOCLOCK); set_task_cpu(p, env->dst_cpu); } @@ -8697,9 +8691,6 @@ static int detach_tasks(struct lb_env *env) continue; next: - if (p->sched_task_hot) - schedstat_inc(p->stats.nr_failed_migrations_hot); - list_move(&p->se.group_node, tasks); }