netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Mc Guire <der.herr@hofr.at>
To: David Laight <David.Laight@ACULAB.COM>
Cc: David Miller <davem@davemloft.net>,
	kuznet@ms2.inr.ac.ru, eric.dumazet@gmail.com, roque@di.fc.ul.pt,
	peterz@infradead.org, netdev@vger.kernel.org
Subject: Re: [PATCH] rebalance locks by converting write_lock_bh towrite_lock+local_bh_disable
Date: Mon, 25 Nov 2013 11:37:51 +0100	[thread overview]
Message-ID: <20131125103751.GC23813@opentech.at> (raw)
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6026B7441@saturn3.aculab.com>

On Mon, 25 Nov 2013, David Laight wrote:

> > in one of the cases I do not understand the intent behind the split:
> > in net/core/sock.c:lock_sock_fast
> > 
> > 	spin_lock_bh(&sk->sk_lock.slock);
> > 	...
> >         spin_unlock(&sk->sk_lock.slock);
> >         /*
> >          * The sk_lock has mutex_lock() semantics here:
> >          */
> >         mutex_acquire(&sk->sk_lock.dep_map, 0, 0, _RET_IP_);
> >         local_bh_enable();
> > 
> >  I think that
> > 
> > 	spin_lock_bh(&sk->sk_lock.slock);
> > 	...
> >         /*
> >          * The sk_lock has mutex_lock() semantics here:
> >          */
> >         mutex_acquire(&sk->sk_lock.dep_map, 0, 0, _RET_IP_);
> >         spin_unlock_bh(&sk->sk_lock.slock);
> > 
> >  should be equivalent ?
> 
> You've added a lock ordering that wasn't there before.
> Also I suspect that mutex_acquire() might be allowed to sleep,
> whereas you shouldn't sleep with a spin lock held.
>
mutex_acquire is not a lock but a lockdep entry. 
As far as I understand it it nither can sleep nor is there a change of 
order here. Am I missing something ?

thx!
hofrat

      reply	other threads:[~2013-11-25 10:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-21 23:54 [PATCH] rebalance locks by converting write_lock_bh to write_lock+local_bh_disable Nicholas Mc Guire
2013-11-23 22:39 ` David Miller
2013-11-23 23:58   ` Nicholas Mc Guire
2013-11-25  9:40     ` [PATCH] rebalance locks by converting write_lock_bh towrite_lock+local_bh_disable David Laight
2013-11-25 10:37       ` Nicholas Mc Guire [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=20131125103751.GC23813@opentech.at \
    --to=der.herr@hofr.at \
    --cc=David.Laight@ACULAB.COM \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=netdev@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=roque@di.fc.ul.pt \
    /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;
as well as URLs for NNTP newsgroup(s).