Skip to content

Commit

Permalink
[CPUFREQ] ondemand: don't synchronize sample rate unless multiple cpu…
Browse files Browse the repository at this point in the history
…s present

For UP systems this is not required, and results in a more consistent
sample interval.

[[email protected]: coding-style fixes]
Signed-off-by: Jocelyn Falempe <[email protected]>
Signed-off-by: Mike Chan <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Dave Jones <[email protected]>
  • Loading branch information
Jocelyn Falempe authored and Dave Jones committed Aug 3, 2010
1 parent 226528c commit a665df9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/cpufreq/cpufreq_ondemand.c
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,9 @@ static void do_dbs_timer(struct work_struct *work)
/* We want all CPUs to do sampling nearly on same jiffy */
int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate);

delay -= jiffies % delay;
if (num_online_cpus() > 1)
delay -= jiffies % delay;

mutex_lock(&dbs_info->timer_mutex);

/* Common NORMAL_SAMPLE setup */
Expand All @@ -634,7 +636,9 @@ static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info)
{
/* We want all CPUs to do sampling nearly on same jiffy */
int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate);
delay -= jiffies % delay;

if (num_online_cpus() > 1)
delay -= jiffies % delay;

dbs_info->sample_type = DBS_NORMAL_SAMPLE;
INIT_DELAYED_WORK_DEFERRABLE(&dbs_info->work, do_dbs_timer);
Expand Down

0 comments on commit a665df9

Please sign in to comment.