[2.6.19 PATCH 1/7] ehea: interface to network stack

Alexey Dobriyan adobriyan at gmail.com
Fri Aug 18 23:47:28 EST 2006


On Fri, Aug 18, 2006 at 01:29:01PM +0200, Jan-Bernd Themann wrote:

Was there noticeable performance difference when explicit prefetching is
removed? At some (invisible) point CPUs will become smarter about prefetching
than programmers and this code will be slower than possible.

> +static inline struct sk_buff *get_skb_by_index(struct sk_buff **skb_array,
> +					       int arr_len,
> +					       struct ehea_cqe *cqe)
> +{
> +	struct sk_buff *skb;
> +	void *pref;
> +	int x;
> +	int skb_index = EHEA_BMASK_GET(EHEA_WR_ID_INDEX, cqe->wr_id);
> +
> +	x = skb_index + 1;
> +	x &= (arr_len - 1);
> +
> +	pref = (void*)skb_array[x];
> +	prefetchw(pref);
> +	prefetchw(pref + EHEA_CACHE_LINE);
> +
> +	pref = (void*)(skb_array[x]->data);
> +	prefetch(pref);
> +	prefetch(pref + EHEA_CACHE_LINE);
> +	prefetch(pref + EHEA_CACHE_LINE * 2);
> +	prefetch(pref + EHEA_CACHE_LINE * 3);
> +	skb = skb_array[skb_index];
> +	skb_array[skb_index] = NULL;
> +	return skb;
> +}
> +
> +static inline struct sk_buff *get_skb_by_index_ll(struct sk_buff **skb_array,
> +						  int arr_len, int wqe_index)
> +{
> +	struct sk_buff *skb;
> +	void *pref;
> +	int x;
> +
> +	x = wqe_index + 1;
> +	x &= (arr_len - 1);
> +
> +	pref = (void*)skb_array[x];
> +	prefetchw(pref);
> +	prefetchw(pref + EHEA_CACHE_LINE);
> +
> +	pref = (void*)(skb_array[x]->data);
> +	prefetchw(pref);
> +	prefetchw(pref + EHEA_CACHE_LINE);
> +
> +	skb = skb_array[wqe_index];
> +	skb_array[wqe_index] = NULL;
> +	return skb;
> +}




More information about the Linuxppc-dev mailing list