All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Love <rml@tech9.net>
To: Bob Miller <rem@osdl.org>
Cc: torvalds@transmeta.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] 2.5.6-pre3 Fix small race in BSD accounting [part 2]
Date: 11 Mar 2002 15:30:03 -0500	[thread overview]
Message-ID: <1015878604.853.66.camel@phantasy> (raw)
In-Reply-To: <20020311120744.B5995@doc.pdx.osdl.net>
In-Reply-To: <20020311120744.B5995@doc.pdx.osdl.net>

On Mon, 2002-03-11 at 15:07, Bob Miller wrote:

> While looking at the bug fix for part 1 I coded up this patch
> to change the BSD accounting code to use a spinlock instead
> of the BKL.

Oh, Good Job - BKL is evil.  And I think that is partly evident in the
resulting code, and I have a couple comments about it.

I suspect the recursive nature of the BKL (and perhaps the locking rules
such that you don't always hold alock, i.e. if name is not NULL) are
responsible for:

	if (!locked)
		spin_lock(&acct_lock);

which really isn't the prettiest or safest thing, although I don't
actually see any problems with it here.  With the BKL removed, it may be
better to rewrite the code in a cleaner and saner way.

I'd much rather see sane locking rules where we knew the callers and
each function entry clearly either held or does not hold the spin_lock. 
Make sure we don't call anything holding the lock, et cetera ...

Also, I like the struct but the defines are a bit ugly.  Why not just
s/acct_lock/acct_globals.lock/, for example, in the code?  Or Just call
the instance of the struct "acct" and have acct.lock, etc.

In other words, good job, but this is a development kernel - rip some of
this cruft up and make it perfect, no?

	Robert Love


  reply	other threads:[~2002-03-11 20:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-11 20:07 [PATCH] 2.5.6-pre3 Fix small race in BSD accounting [part 2] Bob Miller
2002-03-11 20:30 ` Robert Love [this message]
2002-03-11 22:13   ` Bob Miller

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=1015878604.853.66.camel@phantasy \
    --to=rml@tech9.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rem@osdl.org \
    --cc=torvalds@transmeta.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 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.