public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <npiggin@suse.de>
To: David Miller <davem@davemloft.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [rfc][patch] dynamic resizing dentry hash using RCU
Date: Mon, 5 Mar 2007 05:42:00 +0100	[thread overview]
Message-ID: <20070305044200.GA31098@wotan.suse.de> (raw)
In-Reply-To: <20070305042724.GB19783@wotan.suse.de>

On Mon, Mar 05, 2007 at 05:27:24AM +0100, Nick Piggin wrote:
> On Sun, Mar 04, 2007 at 08:11:42PM -0800, David Miller wrote:
> > One minor nit:
> > 
> > > +struct dentry_hash {
> > > +	unsigned int shift;
> > > +	unsigned long mask;
> > > +	struct hlist_head *table;
> > > +};
> > 
> > I don't see any reason to make 'mask' an unsigned long
> > and this makes this structure take up 8 bytes more than
> > necessary on 64-bit.
> 
> You're right, the mask is currently just an int, so my patch should
> not be messing with that. Thanks.
> 
> The other thing you'll have to be careful of when looking at doing
> an implementation, is that I think I forgot to use the RCU accessors
> (rcu_assign_pointer, rcu_dereference) when assigning and loading
> the new/old hash table pointers.

Also, now that I think of it, if resize performance is far far less
important than read-side performance, then you should be able to get
away without the additional smp_rmb() that I add to the read-side
in the algorithm I described.

All you have to do is introduce an additional RCU grace period between
assigning the old pointer to the current table, and the current pointer
to the new table. This will still ensure that an (old_table == NULL &&
cur_table == new_table) condition is impossible (that condition would
mean that one of our active tables is invisible to the reader).

This should truely reduce read-side fastpath overhead to just a single,
predictable branch, an extra read_mostly load or two and the rcu_blah()
bits.


      parent reply	other threads:[~2007-03-05  4:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-23 15:37 [rfc][patch] dynamic resizing dentry hash using RCU Nick Piggin
2007-02-23 16:31 ` Eric Dumazet
2007-02-24  1:08   ` Nick Piggin
2007-02-23 17:25 ` Zach Brown
2007-02-24  1:26   ` Nick Piggin
2007-02-24  2:07     ` Nick Piggin
2007-02-24  1:31   ` Michael K. Edwards
2007-02-24  1:52     ` Nick Piggin
2007-02-24  4:07 ` KAMEZAWA Hiroyuki
2007-02-24  5:15   ` Nick Piggin
2007-02-24  4:24 ` William Lee Irwin III
2007-02-24  5:09   ` Nick Piggin
2007-02-24 22:56     ` William Lee Irwin III
2007-02-25  0:56       ` David Miller
2007-02-25  2:15         ` William Lee Irwin III
2007-02-25  6:21 ` Paul E. McKenney
2007-03-05  4:11 ` David Miller
2007-03-05  4:27   ` Nick Piggin
2007-03-05  4:38     ` David Miller
2007-03-05  4:42     ` Nick Piggin [this message]

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=20070305044200.GA31098@wotan.suse.de \
    --to=npiggin@suse.de \
    --cc=davem@davemloft.net \
    --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