lkml.org 
[lkml]   [2009]   [Oct]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Can current macro be accessed from interrupt context?
On Thu, Oct 22, 2009 at 04:10:49AM -0700, Leonidas . wrote:
> Hello,
>
> Going through UTLK, it says that current macro makes sense only in
> case of process context,
> in case of interrupt context it is invalid.


Indeed, usually it makes only sense in process context.


> But current would still be pointing to interrupted process right? The
> pointer would still be valid?



Yeah, unless you irq handler executes in a threaded interrupt, in
which case current will be pointing to the given irq thread.

There are few tiny cases where it is unsafe to deref "current",
such as the very beginning of a cpu's awakening, when the per cpu
datas are not yet ready for this cpu.


> Can I safely assume that whether or not interrupt handlers are
> executing on separate stacks or
> interrupted threads stack, current macro can be accessed from interrupt context?


Yep.
For example we do that in the function graph tracer. Because we store return
addresses of functions in the "current" task structure. Even if the task
is interrupted, it still makes sense to use current because we want
to know the flow of execution as a linear thing per cpu, the interrupt
is part of that flow

I hope that helps.

Frederic.



\
 
 \ /
  Last update: 2009-10-22 13:31    [W:0.352 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site