[dpdk-dev] rte_mbuf library likely()/unlikely()
Stephen Hemminger
stephen at networkplumber.org
Mon Jul 23 19:37:57 CEST 2018
On Mon, 23 Jul 2018 15:53:42 +0200
Morten Brørup <mb at smartsharesystems.com> wrote:
> Hi Olivier,
>
>
>
> I noticed that __rte_pktmbuf_read() could do with an unlikely(), so I went through the entire library. Here are my suggested modifications.
>
>
>
>
>
> diff -bu rte_mbuf.c.orig rte_mbuf.c
>
> --- rte_mbuf.c.orig 2018-07-23 15:13:22.000000000 +0200
>
> +++ rte_mbuf.c 2018-07-23 15:32:53.000000000 +0200
>
> @@ -173,19 +173,19 @@
>
> {
>
> unsigned int nb_segs, pkt_len;
>
>
>
> - if (m == NULL)
>
> + if (unlikely(m == NULL))
>
> rte_panic("mbuf is NULL\n");
>
>
Adding is unlikely is not necessary since rte_panic is marked with cold attribute
which has the same effect.
More information about the dev
mailing list