lkml.org 
[lkml]   [2010]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    SubjectRe: High CPU load when machine is idle (related to PROBLEM: Unusually high load average when idle in 2.6.35, 2.6.35.1 and later)
    From
    Date
    On Thu, 2010-11-25 at 15:03 +0100, Peter Zijlstra wrote:

    > I'll try and get around to it somewhere this week again.

    How does this work for you? Its hideous but lets start simple.

    ---
    kernel/sched.c | 5 +++++
    kernel/timer.c | 14 ++++++++++++--
    2 files changed, 17 insertions(+), 2 deletions(-)

    diff --git a/kernel/sched.c b/kernel/sched.c
    index dc91a4d..2ebb07c 100644
    --- a/kernel/sched.c
    +++ b/kernel/sched.c
    @@ -3223,6 +3223,11 @@ static void calc_load_account_active(struct rq *this_rq)
    this_rq->calc_load_update += LOAD_FREQ;
    }

    +void calc_load_account_this(void)
    +{
    + calc_load_account_active(this_rq());
    +}
    +
    /*
    * The exact cpuload at various idx values, calculated at every tick would be
    * load = (2^idx - 1) / 2^idx * load + 1 / 2^idx * cur_load
    diff --git a/kernel/timer.c b/kernel/timer.c
    index 68a9ae7..af095c0 100644
    --- a/kernel/timer.c
    +++ b/kernel/timer.c
    @@ -1315,11 +1315,21 @@ void run_local_timers(void)
    * jiffies is defined in the linker script...
    */

    +extern void calc_load_account_this(void);
    +
    void do_timer(unsigned long ticks)
    {
    - jiffies_64 += ticks;
    + if (ticks > 1) {
    + while (ticks--) {
    + jiffies_64++;
    + calc_load_account_this();
    + calc_global_load();
    + }
    + } else {
    + jiffies_64 += ticks;
    + calc_global_load();
    + }
    update_wall_time();
    - calc_global_load();
    }

    #ifdef __ARCH_WANT_SYS_ALARM


    \
     
     \ /
      Last update: 2010-11-27 21:17    [W:0.024 / U:33.792 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site