From 5a2dd92abe2730e7930bbefaa9d2563ecf1f07bc Mon Sep 17 00:00:00 2001 From: Park Bumgyu Date: Tue, 12 Jun 2018 10:23:31 +0900 Subject: [PATCH] sched: ems: prevent access to plugged out cpu. Change-Id: Id9e0ac5cb1979cd8d3766f9fb1a7c0874a561e7b Signed-off-by: Park Bumgyu --- kernel/sched/ems/core.c | 2 +- kernel/sched/ems/energy.c | 2 +- kernel/sched/ems/ontime.c | 2 +- kernel/sched/ems/st_addon.c | 5 +---- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/kernel/sched/ems/core.c b/kernel/sched/ems/core.c index fa23b26716f7..e13179ed3e3e 100644 --- a/kernel/sched/ems/core.c +++ b/kernel/sched/ems/core.c @@ -122,7 +122,7 @@ static int select_proper_cpu(struct task_struct *p, int prev_cpu) unsigned long best_min_util = ULONG_MAX; int best_cpu = -1; - for_each_possible_cpu(cpu) { + for_each_cpu(cpu, cpu_active_mask) { int i; /* visit each coregroup only once */ diff --git a/kernel/sched/ems/energy.c b/kernel/sched/ems/energy.c index 4b403ff63e11..de31fe908d59 100644 --- a/kernel/sched/ems/energy.c +++ b/kernel/sched/ems/energy.c @@ -157,7 +157,7 @@ static unsigned int calculate_energy(struct task_struct *p, int target_cpu) util[cpu] += task_util_est(p); } - for_each_possible_cpu(cpu) { + for_each_cpu(cpu, cpu_active_mask) { struct energy_table *table; unsigned long max_util = 0, util_sum = 0; unsigned long capacity; diff --git a/kernel/sched/ems/ontime.c b/kernel/sched/ems/ontime.c index a5736220e240..e102284be972 100644 --- a/kernel/sched/ems/ontime.c +++ b/kernel/sched/ems/ontime.c @@ -408,7 +408,7 @@ void ontime_migration(void) if (!spin_trylock(&om_lock)) return; - for_each_possible_cpu(cpu) { + for_each_cpu(cpu, cpu_active_mask) { unsigned long flags; struct rq *rq = cpu_rq(cpu); struct sched_entity *se; diff --git a/kernel/sched/ems/st_addon.c b/kernel/sched/ems/st_addon.c index 0909af2a5b5a..7a38172d7ebc 100644 --- a/kernel/sched/ems/st_addon.c +++ b/kernel/sched/ems/st_addon.c @@ -94,7 +94,7 @@ static int select_idle_cpu(struct task_struct *p) int i; char state[30] = "prev_cpu"; - for_each_possible_cpu(cpu) { + for_each_cpu(cpu, cpu_active_mask) { if (cpu != cpumask_first(cpu_coregroup_mask(cpu))) continue; @@ -102,9 +102,6 @@ static int select_idle_cpu(struct task_struct *p) unsigned long capacity_orig = capacity_orig_of(i); unsigned long new_util, wake_util; - if (!cpu_active(i)) - continue; - wake_util = cpu_util_wake(i, p); new_util = wake_util + task_util_est(p); -- 2.20.1