[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1322657130.5297.12.camel@marge.simson.net>
Date: Wed, 30 Nov 2011 13:45:30 +0100
From: Mike Galbraith <efault@....de>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: Steven Rostedt <rostedt@...dmis.org>,
LKML <linux-kernel@...r.kernel.org>,
RT <linux-rt-users@...r.kernel.org>, Ingo Molnar <mingo@...e.hu>,
"Luis Claudio R. Goncalves" <lclaudio@...g.org>,
Clark Williams <williams@...hat.com>
Subject: Re: [PATCH RT] tasklet/rt: Prevent tasklets from going into
infinite spin in RT
On Wed, 2011-11-30 at 11:24 +0100, Thomas Gleixner wrote:
> On Wed, 30 Nov 2011, Mike Galbraith wrote:
> > @@ -486,12 +495,43 @@ extern void softirq_check_pending_idle(v
> > */
> > DECLARE_PER_CPU(struct list_head [NR_SOFTIRQS], softirq_work_list);
> >
> > -DECLARE_PER_CPU(struct task_struct *, ksoftirqd);
> > +struct softirqdata {
> > + int mask;
> > + struct task_struct *tsk;
> > +};
> > +
> > +DECLARE_PER_CPU(struct softirqdata [NR_SOFTIRQ_THREADS], ksoftirqd);
> > +
> > +static inline bool this_cpu_ksoftirqd(struct task_struct *p)
> > +{
> > + int i;
> > +
> > + for (i = 0; i < NR_SOFTIRQ_THREADS; i++) {
> > + if (p == __get_cpu_var(ksoftirqd)[i].tsk)
> > + return true;
>
> You are not serious about that loop, are you ?
Well, it's a short loop, especially when NR_SOFTIRQ_THREADS = 1 (poof).
> > @@ -131,11 +155,18 @@ void softirq_check_pending_idle(void)
> > */
> > static void wakeup_softirqd(void)
> > {
> > - /* Interrupts are disabled: no need to stop preemption */
> > - struct task_struct *tsk = __this_cpu_read(ksoftirqd);
> > + struct task_struct *tsk;
> > + u32 pending = local_softirq_pending(), mask, i;
> >
> > - if (tsk && tsk->state != TASK_RUNNING)
> > - wake_up_process(tsk);
> > + /* Interrupts are disabled: no need to stop preemption */
> > + for (i = 0; pending && i < NR_SOFTIRQ_THREADS; i++) {
> > + mask = __get_cpu_var(ksoftirqd)[i].mask;
> > + if (!(pending & mask))
> > + continue;
> > + tsk = __get_cpu_var(ksoftirqd)[i].tsk;
> > + if (tsk && tsk->state != TASK_RUNNING)
> > + wake_up_process(tsk);
> > + }
> > }
>
> Dammned serious is seems. :)
Deadly serious :)
For the problem at hand (timer wakeups), NR_SOFTIRQ_THREADS could be 2.
> I was looking into that as well, though I did not want to inflict it
> on 3.0 at this point.
>
> Thanks,
>
> tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists