Re: question about nfs_execute_read: why do we need to do lock_kernel?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2006-04-25 at 11:31 -0400, Xin Zhao wrote:
> Thanks for your guys' reply!
> 
> Peter, can you point me somewhere I can check the semantics of BKL? In
> the past, I remembered BKL does block the kernel. So I am quite
> confused now.

That would have been true >10 years ago, when Alan introduced it.
Nowadays, the BKL is just another type of lock, albeit with very unique
properties. The two main ones being:
        - it can be taken recursively.
        - you can call schedule() while holding it.
                Note however, that upon yielding, the process
                automatically gives up the lock, then retakes it when it
                is rescheduled

> Also, I still don't understand why we use lock_kernel instead of some
> finer granularity lock. Trond's answer gave me a feeling that this is
> simply because the code is not carefully optimized.  :)

Sigh... Removing the BKL is not a trivial thing to do. You have make
absolutely sure that you understand the thread data dependencies that
are protected by that lock. That is why we do it gradually.

Cheers,
  Trond

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux