mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rick Lindsley <ricklind@us.ibm.com>
To: Victor Yodaiken <yodaiken@fsmlabs.com>
Cc: Alexander Viro <viro@math.psu.edu>,
	"David C. Hansen" <haveblue@us.ibm.com>,
	Linus Torvalds <torvalds@transmeta.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] remove BKL from drivers' release functions
Date: Fri, 30 Nov 2001 12:02:55 -0800	[thread overview]
Message-ID: <200111302002.fAUK2t407011@eng4.beaverton.ibm.com> (raw)
In-Reply-To: Your message of "Fri, 30 Nov 2001 05:41:26 MST." <20011130054126.A18099@hq2>

    People seem to believe that BKL is worse than added spin-locks, but
    I very much doubt this is always true.

Depends, to some extent, on your definition of "worse". To address
two: the BKL (in general) encourages "worse" design and promotes
"worse" performance. Combine these with a general lack of comments
where clever and subtle code is being employed and the pervasive use of
the BKL can make debugging (or design change) difficult.

The BKL *is* a spinlock, with some questionable special handling in
other parts of the code which permits and encourages poor programming
(like automatically releasing it before you go to sleep, and allowing
you to "acquire" it multiple times).  In general, if you do not need
the special handling, there are compelling reasons to replace it with a
purpose-specific lock (or locking mechanism).

Setting aside architectural and academic issues of "locking design",
the main thing the current practice does, from a performance
standpoint, is create a generic bottleneck.  "One lock to rule them all
..." It creates strange effects like heavy activity in one subsystem
suddenly bogging down a completely disjoint subsystem.  Two separate
locks, in that case, would allow one subsystem to be very busy without
affecting the other.

The advantages gained become more evident on multiple-cpu machines.
Since this is not your most common desktop variant :) the trick is to
introduce changes which allow that hardware to excel while not
impacting the more common case: the single cpu desktop or laptop.  This
is sometimes easy; often, however, it is not, and so the work goes
slowly.

Locks should have clearly defined purpose and scope, just like any
other component of a software system.  The BKL has evolved/mutated
beyond its original scope and needs to be trimmed back.  When it is
trimmed back to either one or zero purposes then, I believe, we can put
down the weed-whackers and stop trimming.

Rick

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

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-28 23:05 David C. Hansen
2001-11-28 23:29 ` Andrew Morton
2001-11-28 23:42   ` David C. Hansen
2001-11-28 23:50   ` Robert Love
2001-11-28 23:36 ` Alan Cox
2001-11-28 23:32   ` David C. Hansen
2001-11-28 23:45     ` Russell King
2001-11-29  0:26       ` David C. Hansen
2001-11-29  0:37         ` Jeff Garzik
2001-11-29  0:41         ` Russell King
2001-11-29  1:33           ` David C. Hansen
2001-11-29  1:42             ` Jeff Garzik
2001-11-29  7:17               ` Oliver Neukum
2001-11-29  1:47             ` Alan Cox
2001-11-29  9:15             ` Russell King
2001-11-29 13:55       ` BALBIR SINGH
2001-11-30 19:30         ` Rick Lindsley
2001-11-30  9:57     ` Alexander Viro
2001-11-30 12:41       ` Victor Yodaiken
2001-11-30 20:02         ` Rick Lindsley [this message]
2001-11-30 19:38       ` David C. Hansen
2001-11-30 23:12         ` Alexander Viro
2001-12-01  0:47           ` Rick Lindsley
2001-12-01  9:52             ` Alan Cox
2001-12-01 10:06               ` Rick Lindsley
2001-11-30 20:11       ` Rick Lindsley

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=200111302002.fAUK2t407011@eng4.beaverton.ibm.com \
    --to=ricklind@us.ibm.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=haveblue@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    --cc=viro@math.psu.edu \
    --cc=yodaiken@fsmlabs.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

all inboxes | Powered by JetHome®