From 2892f9bf5a5aad26970b88a9f10bafd8e043dc86 Mon Sep 17 00:00:00 2001 From: Youngtae Lee Date: Wed, 9 May 2018 20:41:46 +0900 Subject: [PATCH] cpu: Add function to confirm last cpu of cluster. It shows whether last cpu of fasthp_cpus or not Change-Id: Ibf7c6913d78ad32422572759b5576545c85302f5 Signed-off-by: Youngtae Lee --- kernel/cpu.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/kernel/cpu.c b/kernel/cpu.c index 938238e08f10..5a8e86826949 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1619,6 +1619,22 @@ cpu_hotplug_pm_callback(struct notifier_block *nb, return NOTIFY_OK; } +bool cpuhp_last_fastcpu(unsigned int cpu) +{ + struct cpumask mask; + int do_last_cpu; + + if (!cpumask_test_cpu(cpu, &cpu_fastoff_mask)) + return true; + + cpumask_and(&mask, cpu_cluster_mask(cpu), &cpu_fastoff_mask); + do_last_cpu = cpumask_first(&mask); + if (do_last_cpu == cpu) + return true; + + return false; +} +EXPORT_SYMBOL_GPL(cpuhp_last_fastcpu); struct cpumask cpu_fastoff_mask; EXPORT_SYMBOL(cpu_fastoff_mask); -- 2.20.1