public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Love <rml@tech9.net>
To: psusi@cfl.rr.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] (Updated) Preemptible Kernel
Date: 06 Sep 2001 20:58:35 -0400	[thread overview]
Message-ID: <999824322.2429.10.camel@phantasy> (raw)
In-Reply-To: <200109070046.f870kEM06465@smtp-server2.tampabay.rr.com>
In-Reply-To: <999813729.2039.9.camel@phantasy>  <200109070046.f870kEM06465@smtp-server2.tampabay.rr.com>

On Thu, 2001-09-06 at 16:39, Phillip Susi wrote:
> This sounds interesting, but am I correct in assuming that this only allows 
> preemption during code that is called from user space?  For instance, it 
> would be bad to preempt an ISR or BH, right?  Actually... what happens if 
> say, the kernel called from user space is holding a lock, and gets preempted? 
>  Is there a mechanism to disable preemption while holding locks or at other 
> resources that need to be freed before another task is run?
> 
> By the way, are there any other 'modes of execution' for lack of a better 
> word, besides IRS, B, and.... 'called from user space', also for lack of a 
> better word.  Forgive me, I'm not that familiar with the Linux kernel yet.

The SMP locking mechanisms (spinlocks, readlocks, writelocks) are used
to prevent preemption for reentrancy or data validity reasons (this is
the same reason we do this for SMP).  So, there is no worry about
holding locks and whatnot.

We also don't allow preemption during interrupt handling, bottom halves,
or during execution of the scheduler itself.  So, you are correct again,
no preemption during ISRs or BHs.

At all other times, preemption is allowed.  It occurs when another task
comes due for execution -- now, even if in kernel space, we will yield
execution to the new process.  Please give the patch a try, enable
preemption, and see what you think.

Some other changes were made, too.  Certain conditions were prevented
(ie, dont return to user with a pending soft interrupt).  A preemption
counter is maintained, and the locks now modify it.  A new
TASK_PREEMPTING flag was created.

To answer your question, besides system calls (ie, `on behalf of a
process') you have ISRs, BHs, wait-queued routines (a growing number of
these), and other kernel threads (keventd, ksoftirqd, kswapd, etc) which
are typically timer/queued events anyhow.

-- 
Robert M. Love
rml at ufl.edu
rml at tech9.net


  reply	other threads:[~2001-09-07  0:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-06 22:02 [PATCH] (Updated) Preemptible Kernel Robert Love
2001-09-06 20:39 ` Phillip Susi
2001-09-07  0:58   ` Robert Love [this message]
2001-09-07  1:10   ` Daniel Phillips
2001-09-09  4:44 ` Robert Love
  -- strict thread matches above, loose matches on Subject: below --
2001-09-09 22:38 Robert Love
2001-09-19  0:10 Robert Love
2001-09-19  7:18 ` Robert Love
2001-10-01  4:21 Robert Love
2001-10-01  5:34 ` Steve Kieu
2001-10-01  5:46   ` Robert Love

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=999824322.2429.10.camel@phantasy \
    --to=rml@tech9.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=psusi@cfl.rr.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