lkml.org 
[lkml]   [2021]   [Sep]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 6/7] proc/stat: Use unsigned int for "softirq" sum
    Date
    Similarly to "intr" sum value, "softirq" sum is computed by adding up
    unsigned int counters for each CPU returned by kstat_softirqs_cpu().
    To preserve monotonicity, use the same integer type so that the sum
    wraps around consistently. And just like before, this value does not
    need to be explicitly casted into unsigned long long for display.

    Signed-off-by: Alexei Lozovsky <me@ilammy.net>
    ---
    fs/proc/stat.c | 4 ++--
    1 file changed, 2 insertions(+), 2 deletions(-)

    diff --git a/fs/proc/stat.c b/fs/proc/stat.c
    index d31b83b2a175..b7a7de3cd822 100644
    --- a/fs/proc/stat.c
    +++ b/fs/proc/stat.c
    @@ -111,7 +111,7 @@ static int show_stat(struct seq_file *p, void *v)
    u64 user, nice, system, idle, iowait, irq, softirq, steal;
    u64 guest, guest_nice;
    unsigned int sum = 0;
    - u64 sum_softirq = 0;
    + unsigned int sum_softirq = 0;
    unsigned int per_softirq_sums[NR_SOFTIRQS] = {0};
    struct timespec64 boottime;

    @@ -208,7 +208,7 @@ static int show_stat(struct seq_file *p, void *v)
    nr_running(),
    nr_iowait());

    - seq_put_decimal_ull(p, "softirq ", (unsigned long long)sum_softirq);
    + seq_put_decimal_ull(p, "softirq ", sum_softirq);

    for (i = 0; i < NR_SOFTIRQS; i++)
    seq_put_decimal_ull(p, " ", per_softirq_sums[i]);
    --
    2.25.1
    \
     
     \ /
      Last update: 2021-09-11 05:49    [W:8.889 / U:0.228 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site