From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: rte_mbuf library likely()/unlikely() Date: Mon, 23 Jul 2018 10:37:57 -0700 Message-ID: <20180723103757.47e4c26b@xeon-e3> References: <98CBD80474FA8B44BF855DF32C47DC35B421EE@smartserver.smartshare.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: "Olivier Matz" , To: Morten =?UTF-8?B?QnLDuHJ1cA==?= Return-path: Received: from mail-pl0-f49.google.com (mail-pl0-f49.google.com [209.85.160.49]) by dpdk.org (Postfix) with ESMTP id B4DBF235 for ; Mon, 23 Jul 2018 19:38:00 +0200 (CEST) Received: by mail-pl0-f49.google.com with SMTP id j8-v6so457844pll.12 for ; Mon, 23 Jul 2018 10:38:00 -0700 (PDT) In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35B421EE@smartserver.smartshare.dk> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Mon, 23 Jul 2018 15:53:42 +0200 Morten Br=C3=B8rup wrote: > Hi Olivier, >=20 > =20 >=20 > I noticed that __rte_pktmbuf_read() could do with an unlikely(), so I wen= t through the entire library. Here are my suggested modifications. >=20 > =20 >=20 > =20 >=20 > diff -bu rte_mbuf.c.orig rte_mbuf.c >=20 > --- rte_mbuf.c.orig 2018-07-23 15:13:22.000000000 +0200 >=20 > +++ rte_mbuf.c 2018-07-23 15:32:53.000000000 +0200 >=20 > @@ -173,19 +173,19 @@ >=20 > { >=20 > unsigned int nb_segs, pkt_len; >=20 > =20 >=20 > - if (m =3D=3D NULL) >=20 > + if (unlikely(m =3D=3D NULL)) >=20 > rte_panic("mbuf is NULL\n"); >=20 > =20 Adding is unlikely is not necessary since rte_panic is marked with cold att= ribute which has the same effect.