cpufreq Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Len Brown <len.brown@intel.com>
To: davej@codemonkey.org.uk
Cc: alexey.y.starikovskiy@intel.com, cpufreq@lists.linux.org.uk
Subject: [PATCH 1/2 vs 2.6.18rc1] ondemand: tune for hardware coordination
Date: Thu, 13 Jul 2006 16:22:34 -0400	[thread overview]
Message-ID: <200607131622.34806.len.brown@intel.com> (raw)

From: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>

 cpufreq_ondemand.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

Try to make dbs_check_cpu() call on all CPUs at the same jiffy.
This will help when multiple cores share P-states via Hardware Coordination.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>

Index: linux-2.6.15.1/drivers/cpufreq/cpufreq_ondemand.c
===================================================================
--- linux-2.6.15.1.orig/drivers/cpufreq/cpufreq_ondemand.c	2006-07-10 15:34:53.000000000 +0400
+++ linux-2.6.15.1/drivers/cpufreq/cpufreq_ondemand.c	2006-07-12 12:36:18.000000000 +0400
@@ -74,6 +74,7 @@
 
 struct dbs_tuners {
 	unsigned int sampling_rate;
+	unsigned int sampling_rate_jiffies;
 	unsigned int up_threshold;
 	unsigned int ignore_nice;
 };
@@ -139,6 +140,7 @@
 	}
 
 	dbs_tuners_ins.sampling_rate = input;
+	dbs_tuners_ins.sampling_rate_jiffies = usecs_to_jiffies(input);
 	mutex_unlock(&dbs_mutex);
 
 	return count;
@@ -303,26 +305,28 @@
 {
 	unsigned int cpu = smp_processor_id();
 	struct cpu_dbs_info_s *dbs_info = &per_cpu(cpu_dbs_info, cpu);
+	int delay = dbs_tuners_ins.sampling_rate_jiffies -
+		(jiffies % dbs_tuners_ins.sampling_rate_jiffies);
 
 	dbs_check_cpu(dbs_info);
-	queue_delayed_work_on(cpu, kondemand_wq, &dbs_info->work,
-			usecs_to_jiffies(dbs_tuners_ins.sampling_rate));
+	/* We want all CPUs to do sampling nearly on same jiffy */
+	queue_delayed_work_on(cpu, kondemand_wq, &dbs_info->work, delay);
 }
 
 static inline void dbs_timer_init(unsigned int cpu)
 {
 	struct cpu_dbs_info_s *dbs_info = &per_cpu(cpu_dbs_info, cpu);
+	int delay = dbs_tuners_ins.sampling_rate_jiffies -
+		(jiffies % dbs_tuners_ins.sampling_rate_jiffies);
 
 	INIT_WORK(&dbs_info->work, do_dbs_timer, 0);
-	queue_delayed_work_on(cpu, kondemand_wq, &dbs_info->work,
-			usecs_to_jiffies(dbs_tuners_ins.sampling_rate));
-	return;
+	/* We want all CPUs to do sampling nearly on same jiffy */
+	queue_delayed_work_on(cpu, kondemand_wq, &dbs_info->work, delay);
 }
 
 static inline void dbs_timer_exit(unsigned int cpu)
 {
 	struct cpu_dbs_info_s *dbs_info = &per_cpu(cpu_dbs_info, cpu);
-
 	cancel_rearming_delayed_workqueue(kondemand_wq, &dbs_info->work);
 }

                 reply	other threads:[~2006-07-13 20:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200607131622.34806.len.brown@intel.com \
    --to=len.brown@intel.com \
    --cc=alexey.y.starikovskiy@intel.com \
    --cc=cpufreq@lists.linux.org.uk \
    --cc=davej@codemonkey.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox