DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>
To: "vadim.suraev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org"
	<vadim.suraev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: dev-VfR2kkLFssw@public.gmane.org
Subject: Re: [PATCH] rte_mbuf: scattered pktmbufs freeing optimization
Date: Thu, 26 Feb 2015 16:49:41 -0800	[thread overview]
Message-ID: <20150226164941.68d9371a@urahara> (raw)
In-Reply-To: <1424992506-20484-1-git-send-email-vadim.suraev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On Fri, 27 Feb 2015 01:15:06 +0200
"vadim.suraev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <vadim.suraev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> +static inline void __attribute__((always_inline))
> +rte_pktmbuf_free_bulk(struct rte_mbuf *head)

Quit with the inlining. Inlining all the time isn't faster
it just increase the code bloat and causes i-cache misses.

> +{
> +    void *mbufs[MAX_MBUF_FREE_SIZE];
> +    unsigned mbufs_count = 0;
> +    struct rte_mbuf *next;
> +
> +    RTE_MBUF_MEMPOOL_CHECK1(head);
> +
> +    while(head) {
> +        next = head->next;
> +        head->next = NULL;
> +        if(__rte_pktmbuf_prefree_seg(head)) {

Missing space after 'if'

> +            RTE_MBUF_ASSERT(rte_mbuf_refcnt_read(head) == 0);
> +            RTE_MBUF_MEMPOOL_CHECK2(head);
> +            mbufs[mbufs_count++] = head;
> +        }
> +        head = next;
> +        if(mbufs_count == MAX_MBUF_FREE_SIZE) {
> +            rte_mempool_put_bulk(((struct rte_mbuf *)mbufs[0])->pool,mbufs,mbufs_count);
why not have mbufs[] be type struct rte_mbuf * and avoid casting.
Casting is one of the sources of bugs in C code.


> +            mbufs_count = 0;
> +        }
> +    }
> +    if(mbufs_count > 0) {
Don't need {} on one line if clause

> +        rte_mempool_put_bulk(((struct rte_mbuf *)mbufs[0])->pool,mbufs,mbufs_count);
> +    }
> +}

  parent reply	other threads:[~2015-02-27  0:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-26 23:15 [PATCH] rte_mbuf: scattered pktmbufs freeing optimization vadim.suraev-Re5JQEeQqe8AvxtiuMwx3w
     [not found] ` <1424992506-20484-1-git-send-email-vadim.suraev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-02-27  0:49   ` Stephen Hemminger [this message]
2015-02-27 11:17   ` Ananyev, Konstantin
     [not found]     ` <2601191342CEEE43887BDE71AB977258213F2C93-pww93C2UFcwu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-27 12:18       ` Vadim Suraev
     [not found]         ` <2601191342CEEE43887BDE71AB977258213F2E3D@irsmsx105.ger.corp.intel.com>
     [not found]           ` <2601191342CEEE43887BDE71AB977258213F2E3D-pww93C2UFcwu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-27 13:10             ` Ananyev, Konstantin
     [not found]         ` <CAJ0CJ8kJk5F+kygm1hZXX+d8dn0PmpQObyRHuA6uObkHEfMAxg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-02-27 13:20           ` Olivier MATZ
     [not found]             ` <54F06F3A.40401-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-02-27 17:09               ` Vadim Suraev
     [not found]                 ` <CAJ0CJ8=0LCSrBE4QYA1bdKaXRGdNDDhzhpbwJ4oSj_tT+t=CQA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-04  8:54                   ` Olivier MATZ
     [not found]                     ` <54F6C832.4070505-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-03-06 23:24                       ` Vadim Suraev
     [not found]                         ` <CAJ0CJ8nhhESK45c0vY4gxxg1O=1Mv-c=ht=ONEeOKNW9Ao6sHA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-09  8:38                           ` Olivier MATZ

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150226164941.68d9371a@urahara \
    --to=stephen-otpzqlsittunbdjkjebofr2eb7je58tq@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.org \
    --cc=vadim.suraev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox