Menu

#9 io_wait time is treated as CPU time on 2.6 kernel

closed-invalid
5
2004-09-26
2004-09-12
Anonymous
No

cpufreqd treats io_wait time as cpu time, and will ramp
up the processor speed (if such a rule exists).

This is better illustrated by an example:

machine is totally idle and cpu speed is low, check
'top' and /proc/cpuinfo:

Cpu(s): 0.3% us, 0.0% sy, 0.0% ni, 99.7% id, 0.0%
wa, 0.0% hi, 0.0% si

bash-2.05b# cat /proc/cpuinfo
model name : AMD Athlon(tm) 64 Processor 3000+
cpu MHz : 797.962

Then start a process that drives up the io wait time
very high, but still uses very little CPU time:

find / | xargs cat > /dev/null &

Check top and /proc/cpuinfo:

Cpu(s): 0.3% us, 0.7% sy, 0.0% ni, 0.0% id, 98.7%
wa, 0.3% hi, 0.0% si

bash-2.05b# cat /proc/cpuinfo
model name : AMD Athlon(tm) 64 Processor 3000+
cpu MHz : 1798.621

The solution is to not let io_wait time influence the
decision(s) made by cpufreqd.

Here's the context.diff to libsys.c, which fixes this:
*** libsys.c Thu Aug 19 11:35:10 2004
--- libsys.c-no_iowait Sat Sep 11 11:45:36 2004
***************
*** 91,103 ****
fclose(fp);

/* calculate total jiffies, weight them and save */
! c_sys += c_irq + c_softirq;
c_idle += c_iowait;
c_time = c_user + c_nice + c_sys + c_idle;
delta_time = c_time - old_time;
old_time = c_time;

! weighted_activity = c_user + c_nice / 3 + c_sys;
delta_activity = weighted_activity -
old_weighted_activity;
old_weighted_activity = weighted_activity;

--- 91,103 ----
fclose(fp);

/* calculate total jiffies, weight them and save */
! /* c_sys += c_irq + c_softirq; */
c_idle += c_iowait;
c_time = c_user + c_nice + c_sys + c_idle;
delta_time = c_time - old_time;
old_time = c_time;

! weighted_activity = c_user + c_sys;
delta_activity = weighted_activity -
old_weighted_activity;
old_weighted_activity = weighted_activity;

Discussion

  • Nobody/Anonymous

    Logged In: NO

    -oh, the patch also removes c_nice time from influencing the
    cpu speed. This was something I personally wanted, however
    having nice/3 is ok too.

    Thanks for the awesome program!

     
  • Mattia Dongili

    Mattia Dongili - 2004-09-26

    Logged In: YES
    user_id=584271

    hummm, you're doing something wrong here:
    c_idle += c_iowait;
    io_wait time is being added to idle time. What you removed
    is time spent servicing irqs. You can check cpu usasge as
    detected by cpufreqd by running it with verbosity=6 (-V6).
    Launching find / 2>&1 > /dev/null I have:
    get_cpu(): CPU usage = 3.

    About the nice time I'm going to add a new config option
    that let you set the nice-time weight.

    thanks
    --
    mattia

     
  • Mattia Dongili

    Mattia Dongili - 2004-09-26
    • status: open --> closed-invalid
     

Log in to post a comment.