Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1471719

Re: [PATCH 3/4] net/netfilter/nf_conntrack_core: update memory barriers.

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH 3/4] net/netfilter/nf_conntrack_core: update memory barriers.
Date 2016-08-29 13:00 +0200
Message-ID <sbssi-6gC-23@gated-at.bofh.it> (permalink)
References <sb6UO-1cS-7@gated-at.bofh.it> <sb6UO-1cS-9@gated-at.bofh.it> <sb6UO-1cS-11@gated-at.bofh.it> <sb6UO-1cS-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun, Aug 28, 2016 at 01:56:15PM +0200, Manfred Spraul wrote:
> +++ b/net/netfilter/nf_conntrack_core.c
> @@ -80,20 +80,29 @@ static __read_mostly bool nf_conntrack_locks_all;
>  
>  void nf_conntrack_lock(spinlock_t *lock) __acquires(lock)
>  {
> +	/* Step 1: Acquire the lock */
>  	spin_lock(lock);
> -	while (unlikely(nf_conntrack_locks_all)) {
> -		spin_unlock(lock);
>  
> -		/*
> -		 * Order the 'nf_conntrack_locks_all' load vs. the
> -		 * spin_unlock_wait() loads below, to ensure
> -		 * that 'nf_conntrack_locks_all_lock' is indeed held:
> -		 */
> -		smp_rmb(); /* spin_lock(&nf_conntrack_locks_all_lock) */
> -		spin_unlock_wait(&nf_conntrack_locks_all_lock);
> -		spin_lock(lock);
> -	}
> +	/* Step 2: make it visible to all CPUs that we hold the lock */
> +	smp_mb__after_spin_lock();

I hate this comment. A barrier does _not_ make visible anything.

A barrier _orders_ things.

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH 3/4] net/netfilter/nf_conntrack_core: update memory barriers. Manfred Spraul <manfred@colorfullife.com> - 2016-08-28 14:00 +0200
  Re: [PATCH 3/4] net/netfilter/nf_conntrack_core: update memory  barriers. Peter Zijlstra <peterz@infradead.org> - 2016-08-29 13:00 +0200

csiph-web