Hi,
I was looking at the code of cpuidle menu governor. Have some queries
regarding the function
performance_multiplier().
1. In mainline kernel it does -
mult += 2 * get_loadavg();
However, in linux-linaro-tracking, its commented out with below comment -
/*
* this doesn't work as intended - it is almost always 0, but can
* sometimes, depending on workload, spike very high
into the hundreds
* even when the average cpu load is under 10%.
*/
/* mult += 2 * get_loadavg(); */
Does this change need to be upstreamed?
2. In the next line the code does -
/* for IO wait tasks (per cpu!) we add 5x each */
mult += 10 * nr_iowait_cpu(smp_processor_id());
Why is the multiplication by 10? Is the code assuming there are
only 2 cpus (2 * 5)?
Should it be mult += 5 * nr_iowait(); as per comment?
or
for_each_online_cpu(cpu)
mult += 5 * nr_iowait_cpu(cpu);
since we probably want to consider only online cpus?
--
Thanks,
-Meraj
idle_exit event is the first event after a core exits
idle state. So this should be traced before local irq
is ebabled. Likewise idle_entry is the last event before
a core enters idle state. This will ease visualising the
cpu idle state from kernel traces.
Signed-off-by: Sandeep Tripathy <sandeep.tripathy(a)linaro.org>
---
drivers/cpuidle/cpuidle.c | 3 +++
kernel/sched/idle.c | 4 ----
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 8236746..97680d0 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -99,12 +99,15 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv,
ktime_t time_start, time_end;
s64 diff;
+ trace_cpu_idle_rcuidle(index, dev->cpu);
time_start = ktime_get();
entered_state = target_state->enter(dev, drv, index);
time_end = ktime_get();
+ trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu);
+
if (!cpuidle_state_is_coupled(dev, drv, entered_state))
local_irq_enable();
diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
index 8f4390a..07c446a 100644
--- a/kernel/sched/idle.c
+++ b/kernel/sched/idle.c
@@ -141,7 +141,6 @@ static int cpuidle_idle_call(void)
&dev->cpu);
if (!ret) {
- trace_cpu_idle_rcuidle(next_state, dev->cpu);
/*
* Enter the idle state previously
@@ -154,9 +153,6 @@ static int cpuidle_idle_call(void)
entered_state = cpuidle_enter(drv, dev,
next_state);
- trace_cpu_idle_rcuidle(PWR_EVENT_EXIT,
- dev->cpu);
-
if (broadcast)
clockevents_notify(
CLOCK_EVT_NOTIFY_BROADCAST_EXIT,
--
1.9.1
hrtimer_start*() family never fails to enqueue a hrtimer to a clock-base. The
only special case is when the hrtimer was in past. If it is getting enqueued to
local CPUs's clock-base, we raise a softirq and exit, else we handle that on
next interrupt on remote CPU.
At several places in the kernel, we try to make sure if hrtimer was added
properly or not by calling hrtimer_active(), like:
hrtimer_start(timer, expires, mode);
if (hrtimer_active(timer)) {
/* Added successfully */
} else {
/* Was added in the past */
}
As hrtimer_start*() never fails, hrtimer_active() is guaranteed to return '1'.
So, there is no point calling hrtimer_active().
First patch adds a WARN_ON_ONCE() to __hrtimer_start_range_ns() to make sure
hrtimers are always enqueued from it. Next 6 patches update several parts of
kernel to drop calls to hrtimer_active() after starting a hrtimer.
Rebased over 3.16-rc4 and pushed here:
git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/linux.git hrtimer/drop-hrtimer-active-calls
Cc: Darren Hart <dvhart(a)linux.intel.com>
Cc: "David S. Miller" <davem(a)davemloft.net>
Cc: Ingo Molnar <mingo(a)redhat.com>
Cc: netdev(a)vger.kernel.org
Cc: Peter Zijlstra <peterz(a)infradead.org>
Viresh Kumar (7):
hrtimer: Warn if hrtimer_start*() failed to enqueue hrtimer
hrtimer: don't check for active hrtimer after adding it
tick: don't check for active hrtimer after adding it
sched: don't check for active hrtimer after adding it
futex: don't check for active hrtimer after adding it
rtmutex: don't check for active hrtimer after adding it
net: don't check for active hrtimer after adding it
kernel/futex.c | 5 +----
kernel/hrtimer.c | 6 ++----
kernel/locking/rtmutex.c | 5 +----
kernel/sched/core.c | 20 +++++++++-----------
kernel/sched/deadline.c | 2 +-
kernel/time/tick-sched.c | 45 ++++++++++++++++++---------------------------
net/core/pktgen.c | 2 --
7 files changed, 32 insertions(+), 53 deletions(-)
--
2.0.0.rc2