* Spinlock init
@ 2007-06-20 20:12 Jack Stone
2007-06-20 20:29 ` Roland Dreier
0 siblings, 1 reply; 3+ messages in thread
From: Jack Stone @ 2007-06-20 20:12 UTC (permalink / raw)
To: linux-kernel
Dear list,
can rwlock_init and spin_lock_init be used outside of functions declared
__init. The spinlock documentation suggests that it can't but I'd like
someone to confirm that.
Sorry if this has already been answered but I couldn't find anything on it.
Jack
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Spinlock init
2007-06-20 20:12 Spinlock init Jack Stone
@ 2007-06-20 20:29 ` Roland Dreier
2007-06-20 20:31 ` Jack Stone
0 siblings, 1 reply; 3+ messages in thread
From: Roland Dreier @ 2007-06-20 20:29 UTC (permalink / raw)
To: Jack Stone; +Cc: linux-kernel
> can rwlock_init and spin_lock_init be used outside of functions declared
> __init. The spinlock documentation suggests that it can't but I'd like
> someone to confirm that.
Those function can be used in any function. A function is declared
__init if it only runs during the kernel startup, so that the memory
holding the code for __init functions can be freed once startup is
done. However, spin_lock_init() is just used to initialize a freshly
allocated spinlock, and spinlocks may be allocated at any time, even
long after the kernel is done starting up. A quick look throught
kernel source code will show many, many examples where
spin_lock_init(), rwlock_init(), mutex_init(), etc. are called from
non-__init functions.
- R.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Spinlock init
2007-06-20 20:29 ` Roland Dreier
@ 2007-06-20 20:31 ` Jack Stone
0 siblings, 0 replies; 3+ messages in thread
From: Jack Stone @ 2007-06-20 20:31 UTC (permalink / raw)
To: Roland Dreier; +Cc: linux-kernel
Roland Dreier wrote:
> > can rwlock_init and spin_lock_init be used outside of functions declared
> > __init. The spinlock documentation suggests that it can't but I'd like
> > someone to confirm that.
>
> Those function can be used in any function. A function is declared
> __init if it only runs during the kernel startup, so that the memory
> holding the code for __init functions can be freed once startup is
> done. However, spin_lock_init() is just used to initialize a freshly
> allocated spinlock, and spinlocks may be allocated at any time, even
> long after the kernel is done starting up. A quick look throught
> kernel source code will show many, many examples where
> spin_lock_init(), rwlock_init(), mutex_init(), etc. are called from
> non-__init functions.
Exactly what I wanted to hear. Thank you very much.
Jack
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-06-20 20:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-20 20:12 Spinlock init Jack Stone
2007-06-20 20:29 ` Roland Dreier
2007-06-20 20:31 ` Jack Stone
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.