Re: [PATCH] taskstats: fix sub-threads accounting

Oleg Nesterov
2006-10-31T14:31:27Z

On 10/30, Shailabh Nagar wrote:
>
> Oleg Nesterov wrote:
> >
> >Q: We don't send TASKSTATS_TYPE_AGGR_TGID when single-threaded process
> >exits. Is it good? How can the listener figure out that it was actually
> >a process exit, not sub-thread?
>
> We had a detailed discussion on this on lkml earlier. The overhead of
> sending essentially the same data twice (once as AGGR_TGID and once as
> PID) was deemed too heavy esp. as the taskstats structure size grew.
> Also, single threaded exit is a common case.
>
> Using process events, its possible for user space to distinguish single
> threaded process exits.

Ok, I see.

The taskstats's code is very clean and understandable, the only thing
I can't get is: why these listeners are per-cpu? It is very easy to add
'int exited_on_this_cpu' to struct taskstats.

Probaly this was done to filter out unneeded events (cpusets) ? In that
case it seems better to add cpumask_t to 'struct listener' but have a
single listener_array list.

Thanks!

Oleg.