[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1225382486.7803.129.camel@twins>
Date: Thu, 30 Oct 2008 17:01:26 +0100
From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: Eric Dumazet <dada1@...mosbay.com>
Cc: paulmck@...ux.vnet.ibm.com, Corey Minyard <minyard@....org>,
David Miller <davem@...emloft.net>, shemminger@...tta.com,
benny+usenet@...rsen.dk, netdev@...r.kernel.org,
Christoph Lameter <cl@...ux-foundation.org>,
johnpol@....mipt.ru, Christian Bell <christian@...i.com>
Subject: Re: [PATCH] udp: Introduce special NULL pointers for hlist
termination
On Thu, 2008-10-30 at 16:40 +0100, Eric Dumazet wrote:
>
> [PATCH] udp: Introduce special NULL pointers for hlist termination
>
> In order to safely detect changes in chains, we would like to have different
> 'NULL' pointers. Each chain in hash table is terminated by an unique 'NULL'
> value, so that the lockless readers can detect their lookups evaded from
> their starting chain.
>
> We introduce a new type of hlist implementation, named hlist_nulls, were
> we use the least significant bit of the 'ptr' to tell if its a "NULL" value
> or a pointer to an object. We expect to use this new hlist variant for TCP
> as well.
>
> For UDP/UDP-Lite hash table, we use 128 different "NULL" values,
> (UDP_HTABLE_SIZE=128)
>
> Using hlist_nulls saves memory barriers (a read barrier to fetch 'next'
> pointers *before* checking key values) we added in commit
> 96631ed16c514cf8b28fab991a076985ce378c26
> (udp: introduce sk_for_each_rcu_safenext())
>
> This also saves a write memory barrier in udp_lib_get_port(), between
> sk->sk_hash update and sk->next update)
>
> Signed-off-by: Eric Dumazet <dada1@...mosbay.com>
> ---
> include/linux/list_nulls.h | 97 ++++++++++++++++++++++++++++++++
> include/linux/rculist.h | 17 -----
> include/linux/rculist_nulls.h | 55 ++++++++++++++++++
> include/net/sock.h | 50 ++++++++++++----
> include/net/udp.h | 2
> net/ipv4/udp.c | 40 ++++++-------
> net/ipv6/udp.c | 22 ++++---
> 7 files changed, 228 insertions(+), 55 deletions(-)
If we're going to do this, It'd be good to have the list_nulls stuff in
their own patch, as clearly they are not UDP specific.
Also, I think it would be very good to have some extensive comments in
the list_nulls files describing their use in clear and concise language,
because the above changelog doesn't even begin to explain things for
those not following this thread.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists