Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7ad728f9 authored by Rusty Russell's avatar Rusty Russell
Browse files

cpumask: x86: convert cpu_sibling_map/cpu_core_map to cpumask_var_t



Impact: reduce per-cpu size for CONFIG_CPUMASK_OFFSTACK=y

In most places it's cleaner to use the accessors cpu_sibling_mask()
and cpu_core_mask() wrappers which already exist.

I couldn't avoid cleaning up the access in oprofile, either.

Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent fcef8576
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -21,19 +21,19 @@
extern int smp_num_siblings;
extern unsigned int num_processors;

DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
DECLARE_PER_CPU(cpumask_t, cpu_core_map);
DECLARE_PER_CPU(cpumask_var_t, cpu_sibling_map);
DECLARE_PER_CPU(cpumask_var_t, cpu_core_map);
DECLARE_PER_CPU(u16, cpu_llc_id);
DECLARE_PER_CPU(int, cpu_number);

static inline struct cpumask *cpu_sibling_mask(int cpu)
{
	return &per_cpu(cpu_sibling_map, cpu);
	return per_cpu(cpu_sibling_map, cpu);
}

static inline struct cpumask *cpu_core_mask(int cpu)
{
	return &per_cpu(cpu_core_map, cpu);
	return per_cpu(cpu_core_map, cpu);
}

DECLARE_EARLY_PER_CPU(u16, x86_cpu_to_apicid);
+3 −3
Original line number Diff line number Diff line
@@ -249,8 +249,8 @@ extern const struct cpumask *cpu_coregroup_mask(int cpu);
#ifdef ENABLE_TOPO_DEFINES
#define topology_physical_package_id(cpu)	(cpu_data(cpu).phys_proc_id)
#define topology_core_id(cpu)			(cpu_data(cpu).cpu_core_id)
#define topology_core_cpumask(cpu)		(&per_cpu(cpu_core_map, cpu))
#define topology_thread_cpumask(cpu)		(&per_cpu(cpu_sibling_map, cpu))
#define topology_core_cpumask(cpu)		(per_cpu(cpu_core_map, cpu))
#define topology_thread_cpumask(cpu)		(per_cpu(cpu_sibling_map, cpu))

/* indicates that pointers to the topology cpumask_t maps are valid */
#define arch_provides_topology_pointers		yes
@@ -264,7 +264,7 @@ struct pci_bus;
void set_pci_bus_resources_arch_default(struct pci_bus *b);

#ifdef CONFIG_SMP
#define mc_capable()	(cpus_weight(per_cpu(cpu_core_map, 0)) != nr_cpu_ids)
#define mc_capable()	(cpumask_weight(cpu_core_mask(0)) != nr_cpu_ids)
#define smt_capable()			(smp_num_siblings > 1)
#endif

+1 −1
Original line number Diff line number Diff line
@@ -203,7 +203,7 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy)
	unsigned int i;

#ifdef CONFIG_SMP
	cpumask_copy(policy->cpus, &per_cpu(cpu_sibling_map, policy->cpu));
	cpumask_copy(policy->cpus, cpu_sibling_mask(policy->cpu));
#endif

	/* Errata workaround */
+8 −5
Original line number Diff line number Diff line
@@ -56,7 +56,10 @@ static DEFINE_PER_CPU(struct powernow_k8_data *, powernow_data);
static int cpu_family = CPU_OPTERON;

#ifndef CONFIG_SMP
DEFINE_PER_CPU(cpumask_t, cpu_core_map);
static inline const struct cpumask *cpu_core_mask(int cpu)
{
	return cpumask_of(0);
}
#endif

/* Return a frequency in MHz, given an input fid */
@@ -654,7 +657,7 @@ static int fill_powernow_table(struct powernow_k8_data *data, struct pst_s *pst,

	dprintk("cfid 0x%x, cvid 0x%x\n", data->currfid, data->currvid);
	data->powernow_table = powernow_table;
	if (first_cpu(per_cpu(cpu_core_map, data->cpu)) == data->cpu)
	if (cpumask_first(cpu_core_mask(data->cpu)) == data->cpu)
		print_basics(data);

	for (j = 0; j < data->numps; j++)
@@ -808,7 +811,7 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)

	/* fill in data */
	data->numps = data->acpi_data.state_count;
	if (first_cpu(per_cpu(cpu_core_map, data->cpu)) == data->cpu)
	if (cpumask_first(cpu_core_mask(data->cpu)) == data->cpu)
		print_basics(data);
	powernow_k8_acpi_pst_values(data, 0);

@@ -1224,7 +1227,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
	if (cpu_family == CPU_HW_PSTATE)
		cpumask_copy(pol->cpus, cpumask_of(pol->cpu));
	else
		cpumask_copy(pol->cpus, &per_cpu(cpu_core_map, pol->cpu));
		cpumask_copy(pol->cpus, cpu_core_mask(pol->cpu));
	data->available_cores = pol->cpus;

	if (cpu_family == CPU_HW_PSTATE)
@@ -1286,7 +1289,7 @@ static unsigned int powernowk8_get (unsigned int cpu)
	unsigned int khz = 0;
	unsigned int first;

	first = first_cpu(per_cpu(cpu_core_map, cpu));
	first = cpumask_first(cpu_core_mask(cpu));
	data = per_cpu(powernow_data, first);

	if (!data)
+1 −1
Original line number Diff line number Diff line
@@ -322,7 +322,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)

	/* only run on CPU to be set, or on its sibling */
#ifdef CONFIG_SMP
	cpumask_copy(policy->cpus, &per_cpu(cpu_sibling_map, policy->cpu));
	cpumask_copy(policy->cpus, cpu_sibling_mask(policy->cpu));
#endif

	cpus_allowed = current->cpus_allowed;
Loading