Re: [PATCH 5/6] Account ksoftirq time as cpustat softirq
From: Peter Zijlstra
Date: Thu Oct 21 2010 - 10:53:47 EST
On Wed, 2010-10-20 at 15:49 -0700, Venkatesh Pallipadi wrote:
> @@ -1979,15 +1980,20 @@ void account_system_vtime(struct task_struct *curr)
> delta = now - per_cpu(irq_start_time, cpu);
> per_cpu(irq_start_time, cpu) = now;
> /*
> - * We do not account for softirq time from ksoftirqd here.
> * We want to continue accounting softirq time to ksoftirqd thread
> * in that case, so as not to confuse scheduler with a special task
> * that do not consume any time, but still wants to run.
> + * So, softirq time in ksoftirqd is accounted separately and used
> + * for softirq time reporting in /proc/stat.
> */
> - if (in_irq())
> + if (in_irq()) {
> per_cpu(cpu_hardirq_time, cpu) += delta;
> - else if (in_serving_softirq() && !(is_ksoftirqd_context()))
> - per_cpu(cpu_softirq_time, cpu) += delta;
> + } else if (in_serving_softirq()) {
> + if (is_ksoftirqd_context())
> + per_cpu(cpu_ksoftirqd_time, cpu) += delta;
> + else
> + per_cpu(cpu_softirq_time, cpu) += delta;
> + }
>
> local_irq_restore(flags);
> }
> @@ -2025,7 +2031,9 @@ static int irqtime_account_si_update(void)
> int ret = 0;
>
> local_irq_save(flags);
> - latest_ns = __get_cpu_var(cpu_softirq_time);
> + latest_ns = __get_cpu_var(cpu_softirq_time) +
> + __get_cpu_var(cpu_ksoftirqd_time);
wouldn't something like:
latest_ns = this_cpu_read(cpu_softirq_time) +
this_softirq_task()->se.sum_exec_runtime;
be easier?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/