Skip to content

Commit

Permalink
x86: fix call to set_cyc2ns_scale() from time_cpufreq_notifier()
Browse files Browse the repository at this point in the history
In time_cpufreq_notifier() the cpu id to act upon is held in freq->cpu. Use it
instead of smp_processor_id() in the call to set_cyc2ns_scale().
This makes the preempt_*able() unnecessary and lets set_cyc2ns_scale() update
the intended cpu's cyc2ns.

Related mail/thread: http://lkml.org/lkml/2007/12/7/130

Signed-off-by: Karsten Wiese <fzu@wemgehoertderstaat.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Karsten Wiese authored and Ingo Molnar committed Apr 7, 2008
1 parent 5b13d86 commit 4f41c94
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions arch/x86/kernel/tsc_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,7 @@ time_cpufreq_notifier(struct notifier_block *nb, unsigned long val, void *data)
ref_freq, freq->new);
if (!(freq->flags & CPUFREQ_CONST_LOOPS)) {
tsc_khz = cpu_khz;
preempt_disable();
set_cyc2ns_scale(cpu_khz, smp_processor_id());
preempt_enable();
set_cyc2ns_scale(cpu_khz, freq->cpu);
/*
* TSC based sched_clock turns
* to junk w/ cpufreq
Expand Down
4 changes: 1 addition & 3 deletions arch/x86/kernel/tsc_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,7 @@ static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
mark_tsc_unstable("cpufreq changes");
}

preempt_disable();
set_cyc2ns_scale(tsc_khz_ref, smp_processor_id());
preempt_enable();
set_cyc2ns_scale(tsc_khz_ref, freq->cpu);

return 0;
}
Expand Down

0 comments on commit 4f41c94

Please sign in to comment.