[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <B7C6414D-7A69-48DA-8424-5D9F5FC50338@myri.com>
Date: Tue, 28 Oct 2008 14:23:55 -0700
From: Christian Bell <christian@...i.com>
To: Eric Dumazet <dada1@...mosbay.com>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH 1/2] udp: introduce struct udp_table and multiple rwlocks
On Oct 28, 2008, at 1:37 PM, Eric Dumazet wrote:
> -extern struct hlist_head udp_hash[UDP_HTABLE_SIZE];
> -extern rwlock_t udp_hash_lock;
> +struct udp_hslot {
> + struct hlist_head head;
> + rwlock_t lock;
> +};
This structure should be aligned up to cacheline to reduce false
sharing of more than one hslot.
> + } else {
> + hslot = &udptable->hash[udp_hashfn(net, snum)];
> + write_lock_bh(&hslot->lock);
> + if (udp_lib_lport_inuse(net, snum, hslot, sk, saddr_comp))
> + goto fail;
The fail: label below should still unlock_bh when the above condition
fails.
>
> + }
> inet_sk(sk)->num = snum;
> sk->sk_hash = snum;
> if (sk_unhashed(sk)) {
> - sk_add_node(sk, &udptable[udp_hashfn(net, snum)]);
> + sk_add_node(sk, &hslot->head);
> sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
> }
> + write_unlock_bh(&hslot->lock);
> error = 0;
> fail:
> - write_unlock_bh(&udp_hash_lock);
> return error;
> }
cheers,
. . christian
--
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