ANDROID: Fix !CONFIG_SMP build issue with some of the proxy-exec logic

Maciej Żenczykowski reported seeing build failures with configs
using CONFIG_SMP=n

kernel/sched/core.c: In function ‘find_proxy_task’:
kernel/sched/core.c:7476:18: error: implicit declaration of function ‘is_cpu_allowed’; did you mean ‘cpuset_cpus_allowed’? [-Wimplicit-function-d
eclaration]
 7476 |         WARN_ON(!is_cpu_allowed(p, p->wake_cpu));
      |                  ^~~~~~~~~~~~~~
./include/asm-generic/bug.h:123:32: note: in definition of macro ‘WARN_ON’
  123 |         int __ret_warn_on = !!(condition);                              \
      |                                ^~~~~~~~~
kernel/sched/core.c:7476:39: error: ‘struct task_struct’ has no member named ‘wake_cpu’; did you mean ‘wake_q’?
 7476 |         WARN_ON(!is_cpu_allowed(p, p->wake_cpu));
      |                                       ^~~~~~~~

Obviously the logic in find_proxy_task trying to check if return
migration is needed is unnecessary on UP. So lets ifdef it out
as a quick and somewhat ugly solution.

Reported-by: Maciej Żenczykowski <maze@google.com>
Fixes: e4239ea599 ("ANDROID: sched: Handle blocked-waiter migration (and return migration)")
Change-Id: Iee6424745004431589530dddeb92627efe581b78
Signed-off-by: John Stultz <jstultz@google.com>
This commit is contained in:
John Stultz
2025-02-07 13:55:37 -08:00
committed by Treehugger Robot
parent 9634c94147
commit 5933c823d8
+6 -1
View File
@@ -7473,6 +7473,7 @@ find_proxy_task(struct rq *rq, struct task_struct *donor, struct rq_flags *rf)
return owner;
needs_return:
#ifdef CONFIG_SMP
WARN_ON(!is_cpu_allowed(p, p->wake_cpu));
if (p->wake_cpu == this_cpu) {
/* We can actually run here fine */
@@ -7490,7 +7491,11 @@ needs_return:
_trace_sched_pe_return_migration(p);
proxy_migrate_task(rq, rf, p, p->wake_cpu);
return NULL;
#else
/* Nowhere else to migrate on UP */
p->blocked_on_state = BO_RUNNABLE;
ret = p;
#endif
out:
raw_spin_unlock(&p->blocked_lock);
raw_spin_unlock(&mutex->wait_lock);