Discovered that the compiler laid-out asm code in suboptimal way
when studying perf report during benchmarking of cpumap. Help
the compiler by the marking unlikely code paths.
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
headroom = xdp->data - xdp->data_hard_start;
metasize = xdp->data - xdp->data_meta;
metasize = metasize > 0 ? metasize : 0;
- if ((headroom - metasize) < sizeof(*xdp_pkt))
+ if (unlikely((headroom - metasize) < sizeof(*xdp_pkt)))
return NULL;
/* Store info in top of packet */
struct xdp_pkt *xdp_pkt;
xdp_pkt = convert_to_xdp_pkt(xdp);
- if (!xdp_pkt)
+ if (unlikely(!xdp_pkt))
return -EOVERFLOW;
/* Info needed when constructing SKB on remote CPU */