Re: [PATCH net-next v2 5/9] xsk: add xsk_alloc_batch_skb() to build skbs in batch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jason Xing <kerneljasonxing@xxxxxxxxx>
Date: Mon, 25 Aug 2025 21:53:38 +0800

> From: Jason Xing <kernelxing@xxxxxxxxxxx>
> 
> Support allocating and building skbs in batch.

[...]

> +	base_len = max(NET_SKB_PAD, L1_CACHE_ALIGN(dev->needed_headroom));
> +	if (!(dev->priv_flags & IFF_TX_SKB_NO_LINEAR))
> +		base_len += dev->needed_tailroom;
> +
> +	if (xs->skb_count >= nb_pkts)
> +		goto build;
> +
> +	if (xs->skb) {
> +		i = 1;
> +		xs->skb_count++;
> +	}
> +
> +	xs->skb_count += kmem_cache_alloc_bulk(net_hotdata.skbuff_cache,
> +					       gfp_mask, nb_pkts - xs->skb_count,
> +					       (void **)&skbs[xs->skb_count]);

Have you tried napi_skb_cache_get_bulk()? Depending on the workload, it
may give better perf numbers.

> +	if (xs->skb_count < nb_pkts)
> +		nb_pkts = xs->skb_count;

Thanks,
Olek




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux