Re: System or kernel context

Dag Brattli (dagb@cs.uit.no)
29 Oct 1998 11:47:05 +0100


Pavel Machek <pavel@atrey.karlin.mff.cuni.cz> writes:

> Why do not just use current->timeout (now obsolete but easy to use) or
> add_timer() and friends to do this delays/waiting?

Yes I'm doing that, but in a protocol stack its not always easy to know if
the current thread of execution is a sys-call, timer expired or a bh, so to
be safe I have used timers. However, with some types of hardware where you
are required to do small tasks and then wait a little bit (multiple times)
the code can be very hairy if you implement it using timers.

So the best/nicest thing to do is to use current->timeout like this (or
some other variation):

current->timeout = 1;
interruptible_sleep_on( &wait);

But as I understand it, this is not possible if you are running in system
context (from a timer, interrupt or bh). So to use the current->timeout
thing you must have a proper kernel thread like for example kswapd. But how
do I check if my current "thread of execution" is a sys-call, timer,
interrupt or bh?

If current->timeout is obsolete, what is the right way of doing it?

So

Thanks

-- Dag

-- 
   / Dag Brattli                   | Visiting Researcher (1998/1999)      /
  // Research Fellow               | Computing Department                //
 /// University of Tromsoe, Norway | Lancaster University, UK, England  ///
//// http://www.cs.uit.no/~dagb    | Tlf: +44 1524 65201 ext. 93019    ////

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/