The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Andrew Morton <akpm@osdl.org>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: Does smp_reschedule_interrupt really reschedule?
Date: Fri, 13 May 2005 20:26:31 +0200	[thread overview]
Message-ID: <20050513182631.GA15916@elte.hu> (raw)
In-Reply-To: <1116008299.4728.19.camel@localhost.localdomain>


* Steven Rostedt <rostedt@goodmis.org> wrote:

> As the comment says, do nothing since all the work is automatically 
> done at the return from interrupt. But is it?  Doesn't the 
> need_resched need to be set?  Here's what I'm seeing with Ingo's 
> kernel.  I capture the time in sched.c when the 
> smp_send_reschedule_allbutself is called, and also a capture of the 
> time when the schedule actually takes place.  I'm finding differences 
> up to 2 tenths of a second.  That's TENTHS!  I added the following 
> patch:

it's all a bit tricky. The short story is that i think both vanilla and 
-RT kernels are fine.

Here is how smp_send_reschedule() is used:

	CPU#0				CPU#1

	set_tsk_need_resched(rq->curr);
	...
	smp_send_reschedule()
			--- IPI --->
					smp_reschedule_interrupt();
					...
					entry.S's need_resched check

_but_, this is intentionally racy: if CPU#1 happens to reschedule before 
the IPI reaches CPU#1 (an IPI can take 10 usecs easily so the window is 
not small), then need_resched might be cleared before the IPI hits. In 
that case you wont get a reschedule after the IPI hits, because it was 
done before!

so the correct thing to measure is what the -RT kernel's wakeup-latency 
timing feature does: the time from setting need_resched, to the point 
the task starts to run. The feature works on SMP too - and it doesnt 
show any large latencies.

are you seeing actual process delays? If not then i think those large 
latencies are just the result of the wrong assumptions in your 
measurement code.

	Ingo

  reply	other threads:[~2005-05-13 18:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-13 18:18 Does smp_reschedule_interrupt really reschedule? Steven Rostedt
2005-05-13 18:26 ` Ingo Molnar [this message]
2005-05-13 18:51   ` Steven Rostedt
2005-05-14  6:37     ` Ingo Molnar
2005-05-14 11:32       ` Steven Rostedt
2005-05-14 14:27         ` Ingo Molnar

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=20050513182631.GA15916@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /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