ANDROID: cpuhp/pause: schedule cpu_hotplug_work on resume cpu

Resume cpu need to run cpuset_hotplug_workfn which need take
about several milliseconds, and even more if the system have
more tasks.
This isn't suitable to run in the main task context of resume
cpu.
Due to the cpu which is resuming only have active mask,
but still not rebuild sched domain, make this slow
work run on resuming cpu can not take extra overload to
previous active cpus.

Bug: 203839955
Fixes: 1d3a64fbd2 ("ANDROID: cpu/hotplug: rebuild sched
domains immediately")
Change-Id: Ia7bdd077f982950c02696c3598a41b2482046220
Signed-off-by: Tengfei Fan <quic_tengfan@quicinc.com>
Signed-off-by: Maria Yu <quic_aiquny@quicinc.com>
This commit is contained in:
Tengfei Fan
2021-10-22 13:51:11 +08:00
committed by Todd Kjos
parent 2a813b466b
commit 09bd9e940e
3 changed files with 10 additions and 4 deletions

View File

@@ -55,6 +55,7 @@ extern int cpuset_init(void);
extern void cpuset_init_smp(void); extern void cpuset_init_smp(void);
extern void cpuset_force_rebuild(void); extern void cpuset_force_rebuild(void);
extern void cpuset_update_active_cpus(void); extern void cpuset_update_active_cpus(void);
extern void cpuset_update_active_cpus_affine(int cpu);
extern void cpuset_wait_for_hotplug(void); extern void cpuset_wait_for_hotplug(void);
extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask); extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask);
extern void cpuset_cpus_allowed_fallback(struct task_struct *p); extern void cpuset_cpus_allowed_fallback(struct task_struct *p);

View File

@@ -3289,6 +3289,11 @@ void cpuset_update_active_cpus(void)
schedule_work(&cpuset_hotplug_work); schedule_work(&cpuset_hotplug_work);
} }
void cpuset_update_active_cpus_affine(int cpu)
{
schedule_work_on(cpu, &cpuset_hotplug_work);
}
void cpuset_wait_for_hotplug(void) void cpuset_wait_for_hotplug(void)
{ {
flush_work(&cpuset_hotplug_work); flush_work(&cpuset_hotplug_work);

View File

@@ -1361,11 +1361,11 @@ int resume_cpus(struct cpumask *cpus)
prev_prio = pause_reduce_prio(); prev_prio = pause_reduce_prio();
/* Lazy Resume. Build domains immediately instead of scheduling /* Lazy Resume. Build domains through schedule a workqueue on
* a workqueue. This is so that the cpu can pull load when * resuming cpu. This is so that the resuming cpu can work more
* sent a load balancing kick. * early, and cannot add additional load to other busy cpu.
*/ */
cpuset_hotplug_workfn(NULL); cpuset_update_active_cpus_affine(cpumask_first(cpus));
cpus_write_lock(); cpus_write_lock();