Add early_cpu_mask to remember user cpu want to remove.
hotplug and cpufreq driver uses it when control
number of online core.
Change-Id: I20977beb5e338a977f73db9a943d0ac2d3c52d93
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
}
struct pm_qos_request cpu_online_max_qos_req;
+extern struct cpumask early_cpu_mask;
static void enable_domain_cpus(struct exynos_cpufreq_domain *domain)
{
struct cpumask mask;
if (domain == first_domain())
return;
- cpumask_or(&mask, cpu_online_mask, &domain->cpus);
+ cpumask_or(&mask, &early_cpu_mask, &domain->cpus);
pm_qos_update_request(&cpu_online_max_qos_req, cpumask_weight(&mask));
}
if (domain == first_domain())
return;
- cpumask_andnot(&mask, cpu_online_mask, &domain->cpus);
+ cpumask_andnot(&mask, &early_cpu_mask, &domain->cpus);
pm_qos_update_request(&cpu_online_max_qos_req, cpumask_weight(&mask));
}
* than maximum online CPU. If mininum is greater than maximum, online CPU will
* be maximum.
*/
+extern struct cpumask early_cpu_mask;
static struct cpumask create_cpumask(void)
{
int online_cpu_min, online_cpu_max;
cpumask_clear(&mask);
- for (cpu = 0; cpu < online_cpu_min; cpu++)
- cpumask_set_cpu(cpu, &mask);
+ for_each_possible_cpu (cpu) {
+ if (!cpumask_test_cpu(cpu, &early_cpu_mask))
+ continue;
+
+ if (cpumask_weight(&mask) < online_cpu_min)
+ cpumask_set_cpu(cpu, &mask);
+ else
+ break;
+ }
- for (cpu = nr_cpu_ids - 1; cpu >= online_cpu_max; cpu--)
- cpumask_clear_cpu(cpu, &mask);
+ for (cpu = nr_cpu_ids - 1; cpu >= 0; cpu--) {
+ if (!cpumask_test_cpu(cpu, &early_cpu_mask))
+ continue;
+
+ if (cpumask_weight(&mask) > online_cpu_max)
+ cpumask_clear_cpu(cpu, &mask);
+ else
+ break;
+ }
return mask;
}
cpumask_setall(&mask);
cpumask_andnot(&mask, &mask, cpu_online_mask);
+ cpumask_and(&mask, &mask, &early_cpu_mask);
/*
* If it success to enable all CPUs, clear cpu_hotplug.enabled flag.
/* Setup configured maximum number of CPUs to activate */
unsigned int setup_max_cpus = NR_CPUS;
EXPORT_SYMBOL(setup_max_cpus);
+struct cpumask early_cpu_mask;
+EXPORT_SYMBOL(early_cpu_mask);
/*
pr_info("Bringing up secondary CPUs ...\n");
+ cpumask_clear(&early_cpu_mask);
+ cpumask_set_cpu(0, &early_cpu_mask);
/* FIXME: This should be done in userspace --RR */
for_each_present_cpu(cpu) {
if (num_online_cpus() >= setup_max_cpus)
break;
- if (!cpu_online(cpu))
+ if (!cpu_online(cpu)) {
cpu_up(cpu);
+ cpumask_set_cpu(cpu, &early_cpu_mask);
+ }
}
num_nodes = num_online_nodes();