OSDN Git Service

cpumask: Add cpumasks for big and LITTLE CPU clusters
authorSultan Alsawaf <sultan@kerneltoast.com>
Mon, 15 Apr 2019 03:19:37 +0000 (20:19 -0700)
committer0ranko0P <ranko0p@outlook.com>
Sat, 7 Dec 2019 10:00:43 +0000 (18:00 +0800)
Add cpu_lp_mask and cpu_perf_mask to represent the CPUs that belong to
each cluster in a dual-cluster, heterogeneous system.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
arch/arm64/Kconfig
include/linux/cpumask.h
kernel/cpu.c

index ec6a6c0..cf1832f 100644 (file)
@@ -683,6 +683,20 @@ config NR_CPUS
        # These have to remain sorted largest to smallest
        default "64"
 
+config LITTLE_CPU_MASK
+       int "Bitmask of available LITTLE CPUs"
+       help
+         This is a bitmask specifying which of the CPUs are LITTLE in a
+         heterogeneous system. Use 0 if you are unsure, which just results in
+         this storing the bitmask of all available CPUs.
+
+config BIG_CPU_MASK
+       int "Bitmask of available big CPUs"
+       help
+         This is a bitmask specifying which of the CPUs are big in a
+         heterogeneous system. Use 0 if you are unsure, which just results in
+         this storing the bitmask of all available CPUs.
+
 config HOTPLUG_CPU
        bool "Support for hot-pluggable CPUs"
        select GENERIC_IRQ_MIGRATION
index e0bfecd..322be3e 100644 (file)
@@ -54,6 +54,8 @@ extern int nr_cpu_ids;
  *     cpu_online_mask  - has bit 'cpu' set iff cpu available to scheduler
  *     cpu_active_mask  - has bit 'cpu' set iff cpu available to migration
  *     cpu_isolated_mask- has bit 'cpu' set iff cpu isolated
+ *     cpu_lp_mask      - has bit 'cpu' set iff cpu is part of little cluster
+ *     cpu_perf_mask    - has bit 'cpu' set iff cpu is part of big cluster
  *
  *  If !CONFIG_HOTPLUG_CPU, present == possible, and active == online.
  *
@@ -91,6 +93,8 @@ extern const struct cpumask *const cpu_online_mask;
 extern const struct cpumask *const cpu_present_mask;
 extern const struct cpumask *const cpu_active_mask;
 extern const struct cpumask *const cpu_isolated_mask;
+extern const struct cpumask *const cpu_lp_mask;
+extern const struct cpumask *const cpu_perf_mask;
 
 #if NR_CPUS > 1
 #define num_online_cpus()      cpumask_weight(cpu_online_mask)
index 223f8f2..f7f441b 100644 (file)
@@ -857,6 +857,22 @@ static DECLARE_BITMAP(cpu_isolated_bits, CONFIG_NR_CPUS) __read_mostly;
 const struct cpumask *const cpu_isolated_mask = to_cpumask(cpu_isolated_bits);
 EXPORT_SYMBOL(cpu_isolated_mask);
 
+#if CONFIG_LITTLE_CPU_MASK
+static const unsigned long lp_cpu_bits = CONFIG_LITTLE_CPU_MASK;
+const struct cpumask *const cpu_lp_mask = to_cpumask(&lp_cpu_bits);
+#else
+const struct cpumask *const cpu_lp_mask = cpu_possible_mask;
+#endif
+EXPORT_SYMBOL(cpu_lp_mask);
+
+#if CONFIG_BIG_CPU_MASK
+static const unsigned long perf_cpu_bits = CONFIG_BIG_CPU_MASK;
+const struct cpumask *const cpu_perf_mask = to_cpumask(&perf_cpu_bits);
+#else
+const struct cpumask *const cpu_perf_mask = cpu_possible_mask;
+#endif
+EXPORT_SYMBOL(cpu_perf_mask);
+
 void set_cpu_possible(unsigned int cpu, bool possible)
 {
        if (possible)