mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
ANDROID: sched: update is_cpu_allowed tracehook
Currently, the trace hook for is_cpu_allowed only executes if the cpu is not a kthread. Modules need to be able to reject cpus regardless of whether the task is a kthread or not. Modules also need to have the flexibility to execute, or not, the remainder of is_cpu_allowed. Move the tracepoint for is_cpu_allowed so that it is invoked regardless of task's kthread status, but do not interfere with per-cpu-kthread cpu assignment. Bug: 222550772 Change-Id: Ide48a82a33129448bb22be28814267b0b76535a2 Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
This commit is contained in:
committed by
Carlos Llamas
parent
16327a1367
commit
4345c3db84
@@ -2228,20 +2228,20 @@ static inline bool is_cpu_allowed(struct task_struct *p, int cpu)
|
||||
if (is_migration_disabled(p))
|
||||
return cpu_online(cpu);
|
||||
|
||||
/* check for all cases */
|
||||
trace_android_rvh_is_cpu_allowed(cpu, &allowed);
|
||||
|
||||
/* Non kernel threads are not allowed during either online or offline. */
|
||||
if (!(p->flags & PF_KTHREAD)) {
|
||||
if (cpu_active(cpu) && task_cpu_possible(cpu, p)) {
|
||||
trace_android_rvh_is_cpu_allowed(cpu, &allowed);
|
||||
return allowed;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!(p->flags & PF_KTHREAD))
|
||||
return cpu_active(cpu) && task_cpu_possible(cpu, p) && allowed;
|
||||
|
||||
/* KTHREAD_IS_PER_CPU is always allowed. */
|
||||
if (kthread_is_per_cpu(p))
|
||||
return cpu_online(cpu);
|
||||
|
||||
if (!allowed)
|
||||
return false;
|
||||
|
||||
/* Regular kernel threads don't get to stay during offline. */
|
||||
if (cpu_dying(cpu))
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user