Re: [PATCH 3/8] Add a PF flag for ksoftirqd identification

Eric Dumazet
2010-10-15T14:46:39Z

Le lundi 04 octobre 2010 à 17:03 -0700, Venkatesh Pallipadi a écrit :
> To account softirq time cleanly in scheduler, we need to identify whether
> softirq is invoked in ksoftirqd context or softirq at hardirq tail context.
> Add PF_KSOFTIRQD for that purpose.
>
> As all PF flag bits are currently taken, create space by moving one of the
> infrequently used bits (PF_THREAD_BOUND) down in task_struct to be along
> with some other state fields.
>
> Signed-off-by: Venkatesh Pallipadi <venki@google.com>

Instead of using one bit per task (and fight to find a free bit) why not
using existing :

DEFINE_PER_CPU(struct task_struct *, ksoftirqd);

And check if current is ksoftirqd ?

if (__get_cpu_var(ksoftirqd) == current) ...