mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: viro@parcelfarce.linux.theplanet.co.uk
To: Lou Langholtz <ldl@aros.net>
Cc: linux-kernel@vger.kernel.org, Pavel Machek <pavel@ucw.cz>,
	Steven Whitehouse <steve@chygwyn.com>
Subject: Re: [RFC][PATCH] nbd driver for 2.5.72
Date: Sat, 21 Jun 2003 20:31:24 +0100	[thread overview]
Message-ID: <20030621193124.GK6754@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <3EF48A30.3010203@aros.net>

On Sat, Jun 21, 2003 at 10:39:12AM -0600, Lou Langholtz wrote:
> >Why not put these into nbd_device?
> >
> I'd considered that and I'm reconsidering it again now. Not convinced 
> which way to go... Putting something as large as struct request_queue 
> within the nbd_device seems unbalanced somehow. Then again, until 2.5 
> the request_queue was typically shared by multiple devices of the same 
> MAJOR so part of the way the code is has to do with the legacy code. 
> Like the nbd_lock spinlock array and the struct request_queue queue_lock 
> field. Along the lines you're pushing for, why not have struct 
> requests_queue's queue_lock field then be the spinlock itself instead of 
> just being a pointer to a spinlock???

Because often that lock protects driver-internal objects that are used
by all queues.

Prefered variant (actually, we'll have to do it in 2.5 anyway) is to
allocate request_queue dynamically.  Just put a pointer to it into nbd_device.

BTW, could you please kill the ..._t silliness?  There is nothing wroung
with using 'struct nbd_device' directly.
 
> >>+static uint32_t request_magic;
> >>   
> >>
> >
> >???  htonl(NBD_REQUEST_MAGIC) is perfectly OK in the place where you
> >use it and more likely than not will give better code.
> >
> > 
> >
> >>+static uint32_t reply_magic;
> >>   
> >>
> >
> >Ditto.
> >
> What's wrong with having an explicit cache of this value that we can 
> rest assured doesn't in the worst case get compiled into multiple calls 
> to the htonl code?? Possible waste of one 4 byte memory location in the 
> worst compiler case or is there another problem?

htonl() honours constants.  If it doesn't, we are in for much more serious
problems, simply because a lot of codepaths in networking are using it.
A lot.  IOW, you are obfuscating code for no good reason (and add an extra
memory access, thus giving actually worse code - it's not an optimisation
at all).

  reply	other threads:[~2003-06-21 19:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-21  5:43 Lou Langholtz
2003-06-21  6:23 ` Pavel Machek
2003-06-21  6:36 ` Bernd Eckenfels
2003-06-21  7:42   ` Wichert Akkerman
2003-06-23  9:05   ` Lars Marowsky-Bree
2003-06-23 19:21   ` Paul Clements
2003-06-21  6:44 ` Andrew Morton
2003-06-21 15:59   ` Lou Langholtz
2003-06-21  7:04 ` Pavel Machek
2003-06-21  7:32 ` viro
2003-06-21  7:45   ` Sam Ravnborg
2003-06-21 16:39   ` Lou Langholtz
2003-06-21 19:31     ` viro [this message]
2003-06-21 20:23       ` Lou Langholtz
2003-06-22 10:30         ` Jens Axboe
2003-06-22 14:15           ` Lou Langholtz

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=20030621193124.GK6754@parcelfarce.linux.theplanet.co.uk \
    --to=viro@parcelfarce.linux.theplanet.co.uk \
    --cc=ldl@aros.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=steve@chygwyn.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®