lkml.org 
[lkml]   [2004]   [Aug]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] use for_each_cpu

    Hi,

    The per cpu schedule counters need to be summed up over all possible cpus.
    When testing hotplug cpu remove I saw the sum of the online cpu count
    for nr_uninterruptible go negative which made the load average go nuts.

    Anton

    diff -puN kernel/sched.c~debug_nr_running kernel/sched.c
    --- foobar2/kernel/sched.c~debug_nr_running 2004-08-01 14:42:46.133968016 +1000
    +++ foobar2-anton/kernel/sched.c 2004-08-01 15:26:17.272626720 +1000
    @@ -1095,7 +1095,7 @@ unsigned long nr_uninterruptible(void)
    {
    unsigned long i, sum = 0;

    - for_each_online_cpu(i)
    + for_each_cpu(i)
    sum += cpu_rq(i)->nr_uninterruptible;

    return sum;
    @@ -1105,7 +1105,7 @@ unsigned long long nr_context_switches(v
    {
    unsigned long long i, sum = 0;

    - for_each_online_cpu(i)
    + for_each_cpu(i)
    sum += cpu_rq(i)->nr_switches;

    return sum;
    @@ -1115,7 +1115,7 @@ unsigned long nr_iowait(void)
    {
    unsigned long i, sum = 0;

    - for_each_online_cpu(i)
    + for_each_cpu(i)
    sum += atomic_read(&cpu_rq(i)->nr_iowait);

    return sum;
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/
    \
     
     \ /
      Last update: 2005-03-22 14:04    [W:0.019 / U:61.860 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site