linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Galbraith <efault@gmx.de>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	LKML <linux-kernel@vger.kernel.org>,
	RT <linux-rt-users@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
	"Luis Claudio R. Goncalves" <lclaudio@uudg.org>,
	Clark Williams <williams@redhat.com>
Subject: Re: [PATCH RT] tasklet/rt: Prevent tasklets from going into infinite spin in RT
Date: Wed, 30 Nov 2011 13:45:30 +0100	[thread overview]
Message-ID: <1322657130.5297.12.camel@marge.simson.net> (raw)
In-Reply-To: <alpine.LFD.2.02.1111301117240.2735@ionos>

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

  reply	other threads:[~2011-11-30 12:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-30  1:55 [PATCH RT] tasklet/rt: Prevent tasklets from going into infinite spin in RT Steven Rostedt
2011-11-30  3:50 ` Clark Williams
2011-11-30  6:24   ` Mike Kravetz
2011-11-30 15:56     ` Mike Kravetz
2011-11-30  4:32 ` Mike Galbraith
2011-11-30  7:34   ` Mike Galbraith
2011-11-30 10:24   ` Thomas Gleixner
2011-11-30 12:45     ` Mike Galbraith [this message]
2011-11-30 13:04       ` Mike Galbraith
2011-12-01  9:12     ` PATCH RT] resurrect softirq threads for RT_FULL Mike Galbraith
2011-11-30  8:46 ` [PATCH RT] tasklet/rt: Prevent tasklets from going into infinite spin in RT Tim Sander
2011-11-30 14:24 ` Luis Claudio R. Goncalves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1322657130.5297.12.camel@marge.simson.net \
    --to=efault@gmx.de \
    --cc=lclaudio@uudg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=williams@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).