Re: [PATCH 0/4] cputime: Virtual cputime accounting small cleanupsand consolidation

From: Peter Zijlstra
Date: Wed Jun 20 2012 - 18:26:44 EST


On Tue, 2012-06-19 at 15:43 +0200, Frederic Weisbecker wrote:
>
> I wish we could do more vtime cputime accounting consolidation
> but archs do the things pretty differently although I bet the
> behaviour could be more unified.
>
Yes.. so s390,ia64 use thread_info, ppc uses their paca (arch private
precursor to per-cpu data).

So I understand why s390,ia64 want the sched hook, but I don't see why
ppc would need it, their account_process_tick() can fold whatever they
need on the tick.

So I think reworking s390,ia64 to use per-cpu storage should get rid of
this switch hook altogether.


Now everybody using VIRT_CPU_ACCOUNTING has the
syscall/__irq_{enter,exit} hooks and uses 64bit cputime_t.

IRQ_TIME_ACCOUNTING only has the __irq_{enter,exit} hook and uses
unsigned long cputime_t, it adds cputime_one_jiffy every tick when the
per-cpu counter is ahead of the cputime.


We could merge both and do away with the 64bit cputime thing by keeping
a (2nd) per-cpu kernel_cpustat which we fill with optional syscall/irq
hooks and have account_process_tick() first check if any of the
fine-grained fields overflow and if not, fall back to the regular tick
accounting (much like an extended irqtime_account_process_tick).


This would merge the fine-grain and tick based code-paths and do away
with the whole cputime_t mess, it would also merge the VIRT and IRQ
paths and make Frederic's optional syscall accounting trivial.

Or am I missing something obvious here? -- its late after all.

I'll try and write some code tomorrow.
--
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/