mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@debian.org>
To: chas williams <chas@locutus.cmf.nrl.navy.mil>
Cc: Matthew Wilcox <willy@debian.org>,
	linux-kernel@vger.kernel.org,
	"David S. Miller" <davem@redhat.com>
Subject: Re: [PATCH][2.5] convert atm_dev_lock from spinlock to semaphore
Date: Wed, 19 Feb 2003 14:30:52 +0000	[thread overview]
Message-ID: <20030219143052.G22992@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <200302190452.h1J4qoGi002198@locutus.cmf.nrl.navy.mil>; from chas@locutus.cmf.nrl.navy.mil on Tue, Feb 18, 2003 at 11:52:50PM -0500

On Tue, Feb 18, 2003 at 11:52:50PM -0500, chas williams wrote:
> yes, atm_dev_lock is wrapped around large chunks of the code. however,
> it should probably never have been a spinlock--it certainly doesnt need
> to be one.  as a mutex its far less offensive.  i am willing to take
> suggestions as to what would need to be done to fix atm properly?

well, I'm no networking guru, but here are some of the things that seem
useful to me:

Try to use `struct sock' where you can.  For example, using sk->stamp
would allow the SIOCGSTAMP ioctl to be dealt with at a higher level.
Right now, atm uses a timestamp embedded in vcc.  (Actually, I think
I see how to do this one.  I'll send you a patch for your review and
testing, OK?)

Figure out what actually needs to be locked and lock only that.
spinlocks are, by and large, the right solution -- having a Big ATM Lock
isn't a good thing (though I do recognise that you may want to do this
temporarily while you work on fixing it properly).

You should probably do away with SOCKOPS_WRAP / SOCKOPS_WRAPPED.  The
BKL doesn't really protect you from much any more.

Might want to consider converting the proc files to the seqfile interface.

There seems to be some custom doubly-linked-list handling going on in
atm/resources.c.  Should probably be switched to use <linux/list.h>.

I don't like the look of the locking in ipcommon.c:skb_migrate().
If there's really no better way of doing it, I'd recommend something like:

	spinlock_t *first, *second;
	if ((unsigned long)from < (unsigned long) to)) {
		first = &from->lock;
		second = &to->lock;
	} else {
		first = &to->lock;
		second = &from->lock;
	}

	local_irq_save(flags);
	spin_lock(&first);
	spin_lock(&second);

(note that you can leave the spin_unlock and spin_unlock_irqrestore
calls as they are).


That's just a quick survey... I'm sure someone who actually uses ATM
could find more things to look at ;-)

-- 
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk

  reply	other threads:[~2003-02-19 14:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-19  2:53 Matthew Wilcox
2003-02-19  4:47 ` David S. Miller
2003-02-19  5:01   ` chas williams
2003-02-19  4:53     ` David S. Miller
2003-02-19 18:33       ` Mitchell Blank Jr
2003-02-19 21:19         ` Mr. James W. Laferriere
2003-02-19  4:52 ` chas williams
2003-02-19 14:30   ` Matthew Wilcox [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-02-18 21:26 chas williams

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=20030219143052.G22992@parcelfarce.linux.theplanet.co.uk \
    --to=willy@debian.org \
    --cc=chas@locutus.cmf.nrl.navy.mil \
    --cc=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /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®