Subject: Re: [PATCH 1/8] udp: add a counter into udp_hslot

From: Andi Kleen <[email-masked]>
Date: Mon, 09 Nov 2009 11:39:09 +0100

Eric Dumazet <[email-masked]> writes:
>  
> +/**
> + *	struct udp_hslot - UDP hash slot
> + *
> + *	@head:	head of list of sockets
> + *	@count:	number of sockets in 'head' list
> + *	@lock:	spinlock protecting changes to head/count
> + */
>  struct udp_hslot {
>  	struct hlist_nulls_head	head;
> +	int			count;

Do you really need an int? On 64bit it's free due to the alignment, 
but on 32bit x86 it's costly and you blow up the table considerably,
increasing cache misses.
 
Again it would be nicer if that was a separate smaller table together
with the spinlock.

In theory could also put a short counter into the low level alignment
bits of the pointer and perhaps convert the spinlock to a bitlock?
Then all could collapse into a single pointer.

-Andi

-- 
[email-masked] -- Speaking for myself only.