Re: [RFC 4/6] softirq: Run per-group per-cpu ksoftirqd thread

From: Mike Galbraith
Date: Thu Jan 18 2018 - 13:29:28 EST


On Thu, 2018-01-18 at 17:53 +0000, Dmitry Safonov wrote:
> How do you identify in RT one ksoftirqd thread from
> another? I mean, to find which softirq nr the thread is servicing?

static void do_raise_softirq_irqoff(unsigned int nr)
{
struct task_struct *tsk = __this_cpu_ksoftirqd(nr);
unsigned int mask = 1UL << nr;

trace_softirq_raise(nr);
or_softirq_pending(mask);

/*
* If we are not in a hard interrupt and inside a bh disabled
* region, we simply raise the flag on current. local_bh_enable()
* will make sure that the softirq is executed. Otherwise we
* delegate it to the proper softirqd thread for this softirq.
*/
if (!in_irq() && current->softirq_nestcnt) {
if (!(current->flags & PF_KSOFTIRQD) || current == tsk)
current->softirqs_raised |= mask;
else if (tsk) {
tsk->softirqs_raised |= mask;
wakeup_softirqd(nr);
}
} else if (tsk)
tsk->softirqs_raised |= mask;
}