Re: regression introduced by - timers: fix itimer/many thread hang

From: Peter Zijlstra
Date: Fri Nov 07 2008 - 15:26:42 EST



OK, so how about going about this differently.

How about we group the threads per cpu, and appoint one the cpu-leader
and collect the per cpu sum in there.

Then, on tick time we sum the cpu-leaders to obtain the total.

This would require finding the cpu-leader for any particular cpu, which
for example, we could do by maintaining a rb-tree ordered on cpu. If you
find an entry, its the leader and you store a pointer to it, if its
empty, insert yourself.

We'd have to update this whenever a task migrates.

When the cpu-leader migrates it can hand off its sum to the cpu-leader
of the target cpu (assuming there is one, otherwise it will again be
cpu-leader).

The advantage is that the memory foot-print scales with nr_tasks and the
runtime cost is min(nr_tasks, nr_cpus) where nr_cpus is limited to the
cpus the process actually runs on, so this takes full advantage of
things like cpusets.



--
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/