cpumask: Add cpumasks for big and LITTLE CPU clusters

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>
This commit is contained in:
Sultan Alsawaf 2019-04-14 20:19:37 -07:00 committed by Mustafa Gökmen
parent af7d0b5d01
commit e629059826
No known key found for this signature in database
GPG key ID: 3204D8100CFF21ED
3 changed files with 34 additions and 0 deletions

View file

@ -713,6 +713,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

View file

@ -53,6 +53,8 @@ extern int nr_cpu_ids;
* cpu_present_mask - has bit 'cpu' set iff cpu is populated
* 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_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.
*
@ -93,6 +95,8 @@ extern struct cpumask __cpu_active_mask;
#define cpu_online_mask ((const struct cpumask *)&__cpu_online_mask)
#define cpu_present_mask ((const struct cpumask *)&__cpu_present_mask)
#define cpu_active_mask ((const struct cpumask *)&__cpu_active_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)

View file

@ -2610,6 +2610,22 @@ EXPORT_SYMBOL(__cpu_present_mask);
struct cpumask __cpu_active_mask __read_mostly;
EXPORT_SYMBOL(__cpu_active_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 init_cpu_present(const struct cpumask *src)
{
cpumask_copy(&__cpu_present_mask, src);