public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Ian Kent <raven@themaw.net>
Cc: autofs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/6] autofs4: don't take spinlock when not needed in autofs4_lookup_expiring
Date: Wed, 16 Jul 2014 16:10:03 +1000	[thread overview]
Message-ID: <20140716161003.48abe8c1@notabene.brown> (raw)
In-Reply-To: <1405482132.2527.26.camel@perseus.fritz.box>

[-- Attachment #1: Type: text/plain, Size: 2304 bytes --]

On Wed, 16 Jul 2014 11:42:12 +0800 Ian Kent <raven@themaw.net> wrote:

> On Thu, 2014-07-10 at 09:41 +1000, NeilBrown wrote:
> > If the expiring_list is empty, we can avoid a costly spinlock
> > in the rcu-walk path through authfs4_d_manage.
> > 
> > Signed-off-by: NeilBrown <neilb@suse.de>
> 
> I know it should be straight forward to say this is OK but I always
> think twice and again about areas that are subject to race pressure,
> such as the expire to mount pressure of this code.
> 
> After thinking about it for a while now I don't have any reason to think
> this would be a problem. Perhaps later pressure testing will reveal
> something I missed.
> 
> It occurs to me that autofs4_lookup_active() might benefit from a
> similar addition. Multiple calls to ->lookup() made while the dentry is
> still unhashed should have enforced ordering due to the directory
> i_mutex so there shouldn't be a problem adding this. But perhaps you
> haven't seen delays in that function.

Yes I think the same optimisation could apply to autofs4_lookup_active().  It
wouldn't benefit as much though.
autofs4_lookup_active() is only called from autofs4_lookup() which is only
called when the dentry doesn't already exist.  So it isn't called so often
and isn't on the fast path.

However ... maybe "is on the active list" is exactly the "flag" I was wanting
earlier to see if a dentry might be waiting to be mounted on - in which case
d_managed already does the right thing.
I think it is time to read through the code again.  I seem to be
understanding more of it which always helps:-)

Thanks,
NeilBrown


> 
> Acked-by: Ian Kent <raven@themaw.net>
> 
> > ---
> >  fs/autofs4/root.c |    2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
> > index 1ad119407e2f..774c2dab331b 100644
> > --- a/fs/autofs4/root.c
> > +++ b/fs/autofs4/root.c
> > @@ -219,6 +219,8 @@ static struct dentry *autofs4_lookup_expiring(struct dentry *dentry,
> >  	const unsigned char *str = name->name;
> >  	struct list_head *p, *head;
> >  
> > +	if (list_empty(&sbi->expiring_list))
> > +		return NULL;
> >  	spin_lock(&sbi->lookup_lock);
> >  	head = &sbi->expiring_list;
> >  	list_for_each(p, head) {
> > 
> > 
> 


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  reply	other threads:[~2014-07-16  6:10 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-09 23:41 [PATCH 0/6] autofs4: support RCU-walk NeilBrown
2014-07-09 23:41 ` [PATCH 6/6] autofs4: don't take spinlock when not needed in autofs4_lookup_expiring NeilBrown
2014-07-16  3:42   ` Ian Kent
2014-07-16  6:10     ` NeilBrown [this message]
2014-07-09 23:41 ` [PATCH 5/6] autofs4: avoid taking fs_lock during rcu-walk NeilBrown
2014-07-16  9:52   ` Ian Kent
2014-07-09 23:41 ` [PATCH 2/6] autofs4: remove a redundant assignment NeilBrown
2014-07-16  3:27   ` Ian Kent
2014-07-09 23:41 ` [PATCH 1/6] autofs4: remove unused autofs4_ispending() NeilBrown
2014-07-16  3:26   ` Ian Kent
2014-07-09 23:41 ` [PATCH 4/6] autofs4: factor should_expire() out of autofs4_expire_indirect NeilBrown
2014-07-14  0:53   ` [PATCH 4/6 v2] " NeilBrown
2014-07-15  3:48     ` Ian Kent
2014-07-15  4:05       ` NeilBrown
2014-07-15  7:44         ` Ian Kent
2014-07-16  7:50     ` Ian Kent
2014-07-17  4:34       ` NeilBrown
2014-07-09 23:41 ` [PATCH 3/6] autofs4: allow RCU-walk to walk through autofs4 NeilBrown
2014-07-16  4:44   ` Ian Kent
2014-07-16  5:51     ` NeilBrown
2014-07-16  6:56       ` Ian Kent
2014-07-17  5:00         ` Ian Kent
2014-07-17  8:04           ` NeilBrown
2014-07-17 10:17             ` Ian Kent
2014-07-29  1:51               ` NeilBrown
2014-07-29  6:37                 ` Ian Kent
2014-07-10  7:43 ` [PATCH 0/6] autofs4: support RCU-walk Ian Kent
2014-07-10  7:45   ` Ian Kent
2014-07-10  8:25   ` NeilBrown
2014-07-11  2:49     ` Ian Kent
2014-07-16  3:24 ` Ian Kent
2014-07-16  6:00   ` NeilBrown
2014-07-16  7:21     ` Ian Kent

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=20140716161003.48abe8c1@notabene.brown \
    --to=neilb@suse.de \
    --cc=autofs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=raven@themaw.net \
    /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