netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Graf <tgraf@suug.ch>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, herbert@gondor.apana.org.au,
	paulmck@linux.vnet.ibm.com, edumazet@google.com,
	john.r.fastabend@intel.com, josh@joshtriplett.org
Subject: Re: [RFC] netlink: get rid of nl_table_lock
Date: Tue, 6 Jan 2015 23:00:50 +0000	[thread overview]
Message-ID: <20150106230050.GA6870@casper.infradead.org> (raw)
In-Reply-To: <20150103110211.18b11f0f@urahara>

On 01/03/15 at 11:02am, Stephen Hemminger wrote:
> As a follow on to Thomas's patch I think this would complete the
> transistion to RCU for netlink.
> Compile tested only.
> 
> 
> 
> This patch gets rid of the reader/writer nl_table_lock and replaces it
> with exclusively using RCU for reading, and a mutex for writing.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

I like it. One thing I noticed it that it leaves a mix of
native mutex unlocks and unlocks via netlink_table_ungrab().

The Open vSwitch upcall is a pretty good real world Netlink
benchmark. I'll run the tests I have to see if this has any
unexpected side effects.

>  void netlink_table_grab(void)
> -	__acquires(nl_table_lock)
>  {
> -	might_sleep();
> -
> -	write_lock_irq(&nl_table_lock);
> -
> -	if (atomic_read(&nl_table_users)) {
> -		DECLARE_WAITQUEUE(wait, current);
> -
> -		add_wait_queue_exclusive(&nl_table_wait, &wait);
> -		for (;;) {
> -			set_current_state(TASK_UNINTERRUPTIBLE);
> -			if (atomic_read(&nl_table_users) == 0)
> -				break;
> -			write_unlock_irq(&nl_table_lock);
> -			schedule();
> -			write_lock_irq(&nl_table_lock);
> -		}
> -
> -		__set_current_state(TASK_RUNNING);
> -		remove_wait_queue(&nl_table_wait, &wait);
> -	}
> +	mutex_lock(&nl_table_mutex);
>  }

I left this untouched so far as I wasn't clear on what side effect
it would have to remove this as it does explicitely relax writers
right now.

  parent reply	other threads:[~2015-01-06 23:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-02 22:00 [PATCH 0/9 net-next v2] rhashtable: Per bucket locks & deferred table resizing Thomas Graf
2015-01-02 22:00 ` [PATCH 1/9] rhashtable: Do hashing inside of rhashtable_lookup_compare() Thomas Graf
2015-01-16 15:37   ` Patrick McHardy
2015-01-16 16:00     ` Thomas Graf
2015-01-02 22:00 ` [PATCH 2/9] rhashtable: Use rht_obj() instead of manual offset calculation Thomas Graf
2015-01-02 22:00 ` [PATCH 3/9] rhashtable: Convert bucket iterators to take table and index Thomas Graf
2015-01-02 22:00 ` [PATCH 4/9] rhashtable: Factor out bucket_tail() function Thomas Graf
2015-01-02 22:00 ` [PATCH 5/9] nft_hash: Remove rhashtable_remove_pprev() Thomas Graf
2015-01-02 22:00 ` [PATCH 6/9] spinlock: Add spin_lock_bh_nested() Thomas Graf
2015-01-02 22:00 ` [PATCH 7/9] rhashtable: Per bucket locks & deferred expansion/shrinking Thomas Graf
2015-01-02 22:00 ` [PATCH 8/9] rhashtable: Supports for nulls marker Thomas Graf
2015-01-02 22:00 ` [PATCH 9/9] netlink: Lockless lookup with RCU grace period in socket release Thomas Graf
2015-01-03 19:02   ` [RFC] netlink: get rid of nl_table_lock Stephen Hemminger
2015-01-06 22:19     ` David Miller
2015-01-06 23:00     ` Thomas Graf [this message]
2015-01-03 19:44 ` [PATCH 0/9 net-next v2] rhashtable: Per bucket locks & deferred table resizing David Miller

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=20150106230050.GA6870@casper.infradead.org \
    --to=tgraf@suug.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=john.r.fastabend@intel.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=stephen@networkplumber.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;
as well as URLs for NNTP newsgroup(s).