From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org,
Dirk Brandewie <dirk.j.brandewie@intel.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Subject: [PATCH 3.14 66/78] intel_pstate: add sample time scaling
Date: Mon, 9 Jun 2014 15:48:46 -0700 [thread overview]
Message-ID: <20140609224815.459190112@linuxfoundation.org> (raw)
In-Reply-To: <20140609224813.282275135@linuxfoundation.org>
3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dirk Brandewie <dirk.j.brandewie@intel.com>
commit c4ee841f602e5eef8eab673295c49c5b49d7732b upstream.
The PID assumes that samples are of equal time, which for a deferable
timers this is not true when the system goes idle. This causes the
PID to take a long time to converge to the min P state and depending
on the pattern of the idle load can make the P state appear stuck.
The hold-off value of three sample times before using the scaling is
to give a grace period for applications that have high performance
requirements and spend a lot of time idle, The poster child for this
behavior is the ffmpeg benchmark in the Phoronix test suite.
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/cpufreq/intel_pstate.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -60,6 +60,7 @@ struct sample {
u64 aperf;
u64 mperf;
int freq;
+ ktime_t time;
};
struct pstate_data {
@@ -97,6 +98,7 @@ struct cpudata {
struct vid_data vid;
struct _pid pid;
+ ktime_t last_sample_time;
u64 prev_aperf;
u64 prev_mperf;
struct sample sample;
@@ -583,6 +585,8 @@ static inline void intel_pstate_sample(s
aperf = aperf >> FRAC_BITS;
mperf = mperf >> FRAC_BITS;
+ cpu->last_sample_time = cpu->sample.time;
+ cpu->sample.time = ktime_get();
cpu->sample.aperf = aperf;
cpu->sample.mperf = mperf;
cpu->sample.aperf -= cpu->prev_aperf;
@@ -605,12 +609,24 @@ static inline void intel_pstate_set_samp
static inline int32_t intel_pstate_get_scaled_busy(struct cpudata *cpu)
{
- int32_t core_busy, max_pstate, current_pstate;
+ int32_t core_busy, max_pstate, current_pstate, sample_ratio;
+ u32 duration_us;
+ u32 sample_time;
core_busy = cpu->sample.core_pct_busy;
max_pstate = int_tofp(cpu->pstate.max_pstate);
current_pstate = int_tofp(cpu->pstate.current_pstate);
core_busy = mul_fp(core_busy, div_fp(max_pstate, current_pstate));
+
+ sample_time = (pid_params.sample_rate_ms * USEC_PER_MSEC);
+ duration_us = (u32) ktime_us_delta(cpu->sample.time,
+ cpu->last_sample_time);
+ if (duration_us > sample_time * 3) {
+ sample_ratio = div_fp(int_tofp(sample_time),
+ int_tofp(duration_us));
+ core_busy = mul_fp(core_busy, sample_ratio);
+ }
+
return core_busy;
}
next prev parent reply other threads:[~2014-06-09 23:02 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-09 22:47 [PATCH 3.14 00/78] 3.14.7-stable review Greg Kroah-Hartman
2014-06-09 22:47 ` [PATCH 3.14 01/78] sched: Use CPUPRI_NR_PRIORITIES instead of MAX_RT_PRIO in cpupri check Greg Kroah-Hartman
2014-06-09 22:47 ` [PATCH 3.14 02/78] sched/deadline: Fix memory leak Greg Kroah-Hartman
2014-06-09 22:47 ` [PATCH 3.14 03/78] sched: Sanitize irq accounting madness Greg Kroah-Hartman
2014-06-09 22:47 ` [PATCH 3.14 04/78] perf: Prevent false warning in perf_swevent_add Greg Kroah-Hartman
2014-06-09 22:47 ` [PATCH 3.14 05/78] perf: Limit perf_event_attr::sample_period to 63 bits Greg Kroah-Hartman
2014-06-09 22:47 ` [PATCH 3.14 06/78] perf: Fix race in removing an event Greg Kroah-Hartman
2014-06-09 22:47 ` [PATCH 3.14 07/78] mm/memory-failure.c: fix memory leak by race between poison and unpoison Greg Kroah-Hartman
2014-06-09 22:47 ` [PATCH 3.14 08/78] Documentation: fix DOCBOOKS=... building Greg Kroah-Hartman
2014-06-09 22:47 ` [PATCH 3.14 09/78] hwmon: (ntc_thermistor) Fix dependencies Greg Kroah-Hartman
2014-06-09 22:47 ` [PATCH 3.14 10/78] hwmon: (ntc_thermistor) Fix OF device ID mapping Greg Kroah-Hartman
2014-06-09 22:47 ` [PATCH 3.14 11/78] drm/gf119-/disp: fix nasty bug which can clobber SOR0s clock setup Greg Kroah-Hartman
2014-06-09 22:47 ` [PATCH 3.14 16/78] SCSI: scsi_transport_sas: move bsg destructor into sas_rphy_remove Greg Kroah-Hartman
2014-06-09 22:47 ` [PATCH 3.14 18/78] ARM: omap5: hwmod_data: Correct IDLEMODE for McPDM Greg Kroah-Hartman
2014-06-09 22:47 ` [PATCH 3.14 19/78] ARM: OMAP2+: nand: Fix NAND on OMAP2 and OMAP3 boards Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 21/78] ARM: OMAP4: Fix the boot regression with CPU_IDLE enabled Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 22/78] ARM: 8051/1: put_user: fix possible data corruption in put_user Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 24/78] cpufreq: cpu0: drop wrong devm usage Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 25/78] cpufreq: remove race while accessing cur_policy Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 26/78] firewire: revert to 4 GB RDMA, fix protocols using Memory Space Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 27/78] MIPS: Fix typo when reporting cache and ftlb errors for ImgTec cores Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 28/78] dm thin: add no_space_timeout dm-thin-pool module param Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 29/78] dm cache: always split discards on cache block boundaries Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 30/78] Revert "revert "mm: vmscan: do not swap anon pages just because free+file is low"" Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 31/78] virtio_blk: fix race between start and stop queue Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 32/78] sched: Disallow sched_attr::sched_policy < 0 Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 33/78] sched: Make sched_setattr() correctly return -EFBIG Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 34/78] sched/deadline: Change sched_getparam() behaviour vs SCHED_DEADLINE Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 35/78] sched/deadline: Restrict user params max value to 2^63 ns Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 36/78] sched: Fix hotplug vs. set_cpus_allowed_ptr() Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 37/78] sched/dl: Fix race in dl_task_timer() Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 39/78] drm/i915: Only copy back the modified fields to userspace from execbuffer Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 40/78] drm/radeon/dpm: resume fixes for some systems Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 42/78] libata: Blacklist queued trim for Crucial M500 Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 43/78] sched: Fix sched_policy < 0 comparison Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 44/78] md: always set MD_RECOVERY_INTR when aborting a reshape or other "resync" Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 45/78] md: always set MD_RECOVERY_INTR when interrupting a reshape thread Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 47/78] Staging: speakup: Move pasting into a work item Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 48/78] staging: comedi: ni_daq_700: add mux settling delay Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 49/78] Staging: speakup: Update __speakup_paste_selection() tty (ab)usage to match vt Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 50/78] staging: r8192e_pci: fix htons error Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 51/78] Bluetooth: Fix L2CAP LE debugfs entries permissions Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 52/78] ALSA: hda/analog - Fix silent output on ASUS A8JN Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 53/78] ALSA: hda/realtek - Correction of fixup codes for PB V7900 laptop Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 54/78] ALSA: hda/realtek - Fix COEF widget NID for ALC260 replacer fixup Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 55/78] USB: ftdi_sio: add NovaTech OrionLXm product ID Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 58/78] USB: serial: option: add support for Novatel E371 PCIe card Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 59/78] USB: io_ti: fix firmware download on big-endian machines (part 2) Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 60/78] usb: pci-quirks: Prevent Sony VAIO t-series from switching usb ports Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 61/78] USB: Avoid runtime suspend loops for HCDs that cant handle suspend/resume Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 62/78] percpu-refcount: fix usage of this_cpu_ops Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 63/78] intel_pstate: remove unneeded sample buffers Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 64/78] intel_pstate: Remove C0 tracking Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 65/78] intel_pstate: Correct rounding in busy calculation Greg Kroah-Hartman
2014-06-09 22:48 ` Greg Kroah-Hartman [this message]
2014-06-09 22:48 ` [PATCH 3.14 67/78] intel_pstate: Improve initial " Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 68/78] mm: add !pte_present() check on existing hugetlb_entry callbacks Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 69/78] mm: rmap: fix use-after-free in __put_anon_vma Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 70/78] iser-target: Add missing target_put_sess_cmd for ImmedateData failure Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 71/78] iscsi-target: Fix wrong buffer / buffer overrun in iscsi_change_param_value() Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 72/78] target: Fix alua_access_state attribute OOPs for un-configured devices Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 73/78] netfilter: Fix potential use after free in ip6_route_me_harder() Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 74/78] netfilter: nfnetlink: Fix use after free when it fails to process batch Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 77/78] gpio: mcp23s08: Bug fix of SPI device tree registration Greg Kroah-Hartman
2014-06-09 22:48 ` [PATCH 3.14 78/78] [stable PATCH] iommu/vt-d: Fix missing IOTLB flush in intel_iommu_unmap() Greg Kroah-Hartman
2014-06-10 13:26 ` [PATCH 3.14 00/78] 3.14.7-stable review Satoru Takeuchi
2014-06-10 18:46 ` Greg Kroah-Hartman
2014-06-10 15:11 ` Guenter Roeck
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=20140609224815.459190112@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=dirk.j.brandewie@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=stable@vger.kernel.org \
/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