lkml.org 
[lkml]   [2000]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: lock_kernel() in kernel thread
Hello,

lock_kernel() is a reentrant spinlock that is meant to protect
all code that's not SMP safe. In 2.2, this is a good part of the
kernel; in 2.4, it's not very much at all. (It's reentrant
because it can be held across calls to schedule(), a normal
spinlock can't and would deadlock the system if you did that)

Eric

> Hi,
>
> I was wondering why it is necessary for the usb_hub_thread() in
> drivers/usb/hub.c to have the big kernel lock with lock_kernel() ?
>
> What is it with lock_kernel() anyway ?
>
> extern __inline__ void lock_kernel(void)
> {
> #if 1
> if (!++current->lock_depth)
> spin_lock(&kernel_flag);
> #else
> __asm__ __volatile__(
> "incl %1\n\t"
> "jne 9f"
> spin_lock_string
> "\n9:"
> :"=m" (__dummy_lock(&kernel_flag)),
> "=m" (current->lock_depth));
> #endif
> }
>
> Can someone explain what is behind lock_kernel() and
> these changes (#if 1) in 2.4 ?
>
> Is there any documentation for this out there ?
>
--
Eric Lowe
Software Engineer, Systran Corporation
elowe@systran.com


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

\
 
 \ /
  Last update: 2005-03-22 12:41    [W:0.034 / U:18.904 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site