public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lee Revell <rlrevell@joe-job.com>
To: Dave Hansen <haveblue@us.ibm.com>
Cc: Josh Aas <josha@sgi.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	steiner@sgi.com
Subject: Re: bkl cleanup in do_sysctl
Date: Tue, 10 Aug 2004 14:51:59 -0400	[thread overview]
Message-ID: <1092163919.782.54.camel@mindpipe> (raw)
In-Reply-To: <1092158905.11212.18.camel@nighthawk>

On Tue, 2004-08-10 at 13:28, Dave Hansen wrote:

> Remember that the BKL isn't a plain-old spinlock.  You're allowed to
> sleep while holding it and it can be recursively held, which isn't true
> for other spinlocks.
> 
> So, if you want to replace it with a spinlock, you'll need to do audits
> looking for sysctl users that might_sleep() or get called recursively
> somehow.  The might_sleep() debugging checks should help immensely for
> the first part, but all you'll get are deadlocks at runtime for any
> recursive holders.  But, those cases are increasingly rare, so you might
> luck out and not have any.  
> 
> Or, you could just make it a semaphore and forget about the no sleeping
> requirement.  
> 

Someone once suggested that newbies who show up on LKML wanting to learn
kernel hacking should be assigned to find one use of the BKL and replace
it with proper locking.  Something similar worked very well with my
previous employer, before giving someone root, new hires would first be
assigned some task like writing a script to take the user account
database and generate a report of old accounts on a bunch of machines,
or rewrite the RADIUS accounting scripts, where the point was really to
get them familiar with the system.

This way, even if they come back with a totally botched fix, someone
will probably just post a correct one.  We could get rid of the BKL very
soon, I count only 247 files with lock_kernel in them.

For example reiserfs uses the BKL for all write locking (!), but it
probably would not be too hard to fix, because you can just look at
another filesystem that has proper locking.

Maybe this should be added to the FAQ:

Q:  I want to hack the kernel, and I *think* I know what I am doing. 
Where do I start?

Lee


  reply	other threads:[~2004-08-10 19:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-10 16:58 bkl cleanup in do_sysctl Josh Aas
2004-08-10 17:28 ` Dave Hansen
2004-08-10 18:51   ` Lee Revell [this message]
2004-08-10 19:16     ` Roland Dreier
2004-08-10 19:21       ` Lee Revell
2004-08-10 19:46     ` Hans Reiser
2004-08-10 20:10       ` Lee Revell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1092163919.782.54.camel@mindpipe \
    --to=rlrevell@joe-job.com \
    --cc=haveblue@us.ibm.com \
    --cc=josha@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=steiner@sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox