Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 48634
b: refs/heads/master
c: 529af7a
h: refs/heads/master
v: v3
  • Loading branch information
Venkatesh Pallipadi authored and Dave Jones committed Feb 11, 2007
1 parent 56294df commit 3463c30
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5a01f2e8f3ac134e24144d74bb48a60236f7024d
refs/heads/master: 529af7a14f04f92213bac371931a2b2b060c63fa
28 changes: 16 additions & 12 deletions trunk/drivers/cpufreq/cpufreq_ondemand.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,20 @@ static unsigned int def_sampling_rate;
static void do_dbs_timer(struct work_struct *work);

/* Sampling types */
enum dbs_sample {DBS_NORMAL_SAMPLE, DBS_SUB_SAMPLE};
enum {DBS_NORMAL_SAMPLE, DBS_SUB_SAMPLE};

struct cpu_dbs_info_s {
cputime64_t prev_cpu_idle;
cputime64_t prev_cpu_wall;
struct cpufreq_policy *cur_policy;
struct delayed_work work;
enum dbs_sample sample_type;
unsigned int enable;
struct cpufreq_frequency_table *freq_table;
unsigned int freq_lo;
unsigned int freq_lo_jiffies;
unsigned int freq_hi_jiffies;
int cpu;
unsigned int enable:1,
sample_type:1;
};
static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info);

Expand Down Expand Up @@ -402,7 +403,7 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
if (load < (dbs_tuners_ins.up_threshold - 10)) {
unsigned int freq_next, freq_cur;

freq_cur = cpufreq_driver_getavg(policy);
freq_cur = __cpufreq_driver_getavg(policy);
if (!freq_cur)
freq_cur = policy->cur;

Expand All @@ -423,9 +424,11 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)

static void do_dbs_timer(struct work_struct *work)
{
unsigned int cpu = smp_processor_id();
struct cpu_dbs_info_s *dbs_info = &per_cpu(cpu_dbs_info, cpu);
enum dbs_sample sample_type = dbs_info->sample_type;
struct cpu_dbs_info_s *dbs_info =
container_of(work, struct cpu_dbs_info_s, work.work);
unsigned int cpu = dbs_info->cpu;
int sample_type = dbs_info->sample_type;

/* We want all CPUs to do sampling nearly on same jiffy */
int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate);

Expand Down Expand Up @@ -454,17 +457,17 @@ static void do_dbs_timer(struct work_struct *work)
queue_delayed_work_on(cpu, kondemand_wq, &dbs_info->work, delay);
}

static inline void dbs_timer_init(unsigned int cpu)
static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info)
{
struct cpu_dbs_info_s *dbs_info = &per_cpu(cpu_dbs_info, cpu);
/* We want all CPUs to do sampling nearly on same jiffy */
int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate);
delay -= jiffies % delay;

ondemand_powersave_bias_init();
INIT_DELAYED_WORK_NAR(&dbs_info->work, do_dbs_timer);
dbs_info->sample_type = DBS_NORMAL_SAMPLE;
queue_delayed_work_on(cpu, kondemand_wq, &dbs_info->work, delay);
INIT_DELAYED_WORK_NAR(&dbs_info->work, do_dbs_timer);
queue_delayed_work_on(dbs_info->cpu, kondemand_wq, &dbs_info->work,
delay);
}

static inline void dbs_timer_exit(struct cpu_dbs_info_s *dbs_info)
Expand Down Expand Up @@ -528,6 +531,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
j_dbs_info->prev_cpu_idle = get_cpu_idle_time(j);
j_dbs_info->prev_cpu_wall = get_jiffies_64();
}
this_dbs_info->cpu = cpu;
this_dbs_info->enable = 1;
/*
* Start the timerschedule work, when this governor
Expand All @@ -548,7 +552,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,

dbs_tuners_ins.sampling_rate = def_sampling_rate;
}
dbs_timer_init(policy->cpu);
dbs_timer_init(this_dbs_info);

mutex_unlock(&dbs_mutex);
break;
Expand Down

0 comments on commit 3463c30

Please sign in to comment.