From: George Anzinger <george@mvista.com>
To: "linux-os (Dick Johnson)" <linux-os@analogic.com>
Cc: "Sat." <walking.to.remember@gmail.com>,
Christopher Friesen <cfriesen@nortel.com>,
linux-kernel@vger.kernel.org
Subject: Re: when or where can the case occur in "linux kernel development " about "kernel preemption"?
Date: Mon, 29 Aug 2005 10:54:06 -0700 [thread overview]
Message-ID: <43134BBE.8040605@mvista.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0508290742540.27714@chaos.analogic.com>
linux-os (Dick Johnson) wrote:
> On Sat, 27 Aug 2005, Sat. wrote:
>
>
>>2005/8/27, Christopher Friesen <cfriesen@nortel.com>:
>>
>>>Sat. wrote:
>>>
>>>>the case about kernel preemption as follow :
>>>>
>>>>the book said "when a process that has a higher priority than the
>>>>currenty running process is awakened ".
>>>>
>>>>but I can think about when such case can occur , could you give me an example ?
>>>
>>>There may be others, but one common case is when a hardware interrupt
>>>causes the higher priority process to become runnable. Some examples of
>>>this would be a network packet arriving, or the expiry of a hardware timer.
>>>
>>>Chris
>>>
>>
>>unfortunately, I cannot agree with you , normally ,when the kernel
>>runs in interrupt context , the schedule() should not be invoked
>>------my views .
>>
>>then,could anyone give me a definite example about network like above
>>or anything else to eluminate this , ok?
>>
>>thanks !
>>
>>--
>
>
>>Sat.
>
>
> Schedule is never executed from an interrupt, BUT, there may be
> kernel threads or even user tasks that are sleeping, waiting
> to be awakened when some preliminary interrupt processing has
> occurred. The interrupt code may execute one of the wake-up calls
> which will cause the target to be put into the run queue as soon
> as possible.
>
Actually, this is not completly true. The kernel sets a flag while
handling interrupts that says it is within an interrupt. This flag is
cleared on the way out of the interrupt but prior to the return from
interrupt (rfi) instruction. Between this flag clearing and the rfi,
there is a check made to see if the kernel is preemptable and, if so, if
it is desired (i.e. something more important should run NOW). If both
of these are true, schedule is called to do the context switch. So,
schedule IS called from within the interrupt, but NOT within the area
the kernel flags as being in an interrupt which is a subset of the
actual interrupt.
--
George Anzinger george@mvista.com
HRT (High-res-timers): http://sourceforge.net/projects/high-res-timers/
prev parent reply other threads:[~2005-08-29 19:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-26 16:20 when or where can the case occur in "linux kernel development " about "kernel preemption"? Sat.
2005-08-26 16:40 ` Christopher Friesen
2005-08-27 15:57 ` Sat.
2005-08-28 7:05 ` Gaurav Dhiman
2005-08-29 11:46 ` linux-os (Dick Johnson)
2005-08-29 17:54 ` George Anzinger [this message]
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=43134BBE.8040605@mvista.com \
--to=george@mvista.com \
--cc=cfriesen@nortel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-os@analogic.com \
--cc=walking.to.remember@gmail.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