lkml.org 
[lkml]   [1999]   [May]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Question on spinlocks and reentrancy

On Fri, 14 May 1999, B. James Phillippe wrote:

> For example, say I am about to muddle with some members of current. If I
> am in init_module() do I need a spinlock (like lock_kernel())? How about
> in a system call that has no chance of sleeping? From within tq_scheduler?
> What about within a kernel thread? Say I do a "struct task_struct *task =
> current" and then only access members through task; do I still need a
> spinlock at all?

'current' is guaranteed to not go away under you. (that is true on both UP
and SMP). There are certain structures within 'current' that have a
spinlock, the signal structures for example. The rule typically is that if
a structure is completely private to 'current' then you need no spinlock.
Shared fields (eg. 'priority' can be set from another process) have either
the lock_kernel() protection (old, not yet SMP-parallelized code), or some
own spinlock/counter like the signal struct. Does this answer your
question?

-- mingo


-
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/

\
 
 \ /
  Last update: 2005-03-22 13:51    [W:0.080 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site