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

Commit 7b543a53 authored by Tejun Heo's avatar Tejun Heo
Browse files

x86: Replace uses of current_cpu_data with this_cpu ops



Replace all uses of current_cpu_data with this_cpu operations on the
per cpu structure cpu_info.  The scala accesses are replaced with the
matching this_cpu ops which results in smaller and more efficient
code.

In the long run, it might be a good idea to remove cpu_data() macro
too and use per_cpu macro directly.

tj: updated description

Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>
Acked-by: default avatarH. Peter Anvin <hpa@zytor.com>
Acked-by: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 0a3aee0d
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -141,10 +141,9 @@ extern __u32 cpu_caps_set[NCAPINTS];
#ifdef CONFIG_SMP
DECLARE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info);
#define cpu_data(cpu)		per_cpu(cpu_info, cpu)
#define current_cpu_data	__get_cpu_var(cpu_info)
#else
#define cpu_info		boot_cpu_data
#define cpu_data(cpu)		boot_cpu_data
#define current_cpu_data	boot_cpu_data
#endif

extern const struct seq_operations cpuinfo_op;
+1 −1
Original line number Diff line number Diff line
@@ -516,7 +516,7 @@ static void __cpuinit setup_APIC_timer(void)
{
	struct clock_event_device *levt = &__get_cpu_var(lapic_events);

	if (cpu_has(&current_cpu_data, X86_FEATURE_ARAT)) {
	if (cpu_has(__this_cpu_ptr(&cpu_info), X86_FEATURE_ARAT)) {
		lapic_clockevent.features &= ~CLOCK_EVT_FEAT_C3STOP;
		/* Make LAPIC timer preferrable over percpu HPET */
		lapic_clockevent.rating = 150;
+1 −1
Original line number Diff line number Diff line
@@ -668,7 +668,7 @@ EXPORT_SYMBOL_GPL(amd_erratum_383);

bool cpu_has_amd_erratum(const int *erratum)
{
	struct cpuinfo_x86 *cpu = &current_cpu_data;
	struct cpuinfo_x86 *cpu = __this_cpu_ptr(&cpu_info);
	int osvw_id = *erratum++;
	u32 range;
	u32 ms;
+1 −1
Original line number Diff line number Diff line
@@ -521,7 +521,7 @@ static void check_supported_cpu(void *_rc)

	*rc = -ENODEV;

	if (current_cpu_data.x86_vendor != X86_VENDOR_AMD)
	if (__this_cpu_read(cpu_info.x86_vendor) != X86_VENDOR_AMD)
		return;

	eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE);
+2 −2
Original line number Diff line number Diff line
@@ -266,7 +266,7 @@ amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax,
		line_size = l2.line_size;
		lines_per_tag = l2.lines_per_tag;
		/* cpu_data has errata corrections for K7 applied */
		size_in_kb = current_cpu_data.x86_cache_size;
		size_in_kb = __this_cpu_read(cpu_info.x86_cache_size);
		break;
	case 3:
		if (!l3.val)
@@ -288,7 +288,7 @@ amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax,
	eax->split.type = types[leaf];
	eax->split.level = levels[leaf];
	eax->split.num_threads_sharing = 0;
	eax->split.num_cores_on_die = current_cpu_data.x86_max_cores - 1;
	eax->split.num_cores_on_die = __this_cpu_read(cpu_info.x86_max_cores) - 1;


	if (assoc == 0xffff)
Loading