cpu: Add function to confirm last cpu of cluster.
authorYoungtae Lee <yt0729.lee@samsung.com>
Wed, 9 May 2018 11:41:46 +0000 (20:41 +0900)
committerlakkyung.jung <lakkyung.jung@samsung.com>
Mon, 23 Jul 2018 05:59:15 +0000 (14:59 +0900)
It shows whether last cpu of fasthp_cpus or not

Change-Id: Ibf7c6913d78ad32422572759b5576545c85302f5
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
kernel/cpu.c

index 938238e08f10fbec7426e031b676279d92a34f89..5a8e868269494938f7e6f62bef459b5942888d8a 100644 (file)
@@ -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);