DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] rte_prefetch0() performance info
@ 2015-03-05  8:46 Parikshith Chowdaiah
  2015-03-05  8:51 ` Anuj Kalia
  0 siblings, 1 reply; 2+ messages in thread
From: Parikshith Chowdaiah @ 2015-03-05  8:46 UTC (permalink / raw)
  To: dev

Hi all,
I have a question related to usage of rte_prefetch0() function,In one of
the sample files, we have implementation like:

            /* Prefetch first packets */

            for (j = 0; j < PREFETCH_OFFSET && j < nb_rx; j++) {

                rte_prefetch0(rte_pktmbuf_mtod(

                        pkts_burst[j], void *));

            }



            /* Prefetch and forward already prefetched packets */

            for (j = 0; j < (nb_rx - PREFETCH_OFFSET); j++) {

                rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[

                        j + PREFETCH_OFFSET], void *));

                l3fwd_simple_forward(pkts_burst[j], portid,

                                qconf);

            }



            /* Forward remaining prefetched packets */

            for (; j < nb_rx; j++) {

                l3fwd_simple_forward(pkts_burst[j], portid,

                                qconf);

            }


where the prefetch0() is carried out in multiple split iterations, would
like to have an insight on whether it makes performance improvement to
likes of:



       for (j = 0; j  < nb_rx; j++) {

                rte_prefetch0(rte_pktmbuf_mtod(

                        pkts_burst[j], void *));

            }


and how frequent rte_prefetch() needs to called for the same packet. and
any mechanisms to call in bulk for 64 packets at once ?


thanks

Parikshith

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] rte_prefetch0() performance info
  2015-03-05  8:46 [dpdk-dev] rte_prefetch0() performance info Parikshith Chowdaiah
@ 2015-03-05  8:51 ` Anuj Kalia
  0 siblings, 0 replies; 2+ messages in thread
From: Anuj Kalia @ 2015-03-05  8:51 UTC (permalink / raw)
  To: Parikshith Chowdaiah; +Cc: dev

Hi Parikshith.

A CPU core can have a limited number of prefetches in flight (around 10).
So if you issue 64 (or nb_rx > 10) prefetches in quick succession, you'll
stall on memory access. The main idea here is to overlap prefetches of some
packets with computation from other packets.

This paper explains it in the context of hash tables, but the idea is
similar: https://www.cs.cmu.edu/~binfan/papers/conext13_cuckooswitch.pdf

--Anuj

On Thu, Mar 5, 2015 at 3:46 AM, Parikshith Chowdaiah <pchowdai@gmail.com>
wrote:

> Hi all,
> I have a question related to usage of rte_prefetch0() function,In one of
> the sample files, we have implementation like:
>
>             /* Prefetch first packets */
>
>             for (j = 0; j < PREFETCH_OFFSET && j < nb_rx; j++) {
>
>                 rte_prefetch0(rte_pktmbuf_mtod(
>
>                         pkts_burst[j], void *));
>
>             }
>
>
>
>             /* Prefetch and forward already prefetched packets */
>
>             for (j = 0; j < (nb_rx - PREFETCH_OFFSET); j++) {
>
>                 rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[
>
>                         j + PREFETCH_OFFSET], void *));
>
>                 l3fwd_simple_forward(pkts_burst[j], portid,
>
>                                 qconf);
>
>             }
>
>
>
>             /* Forward remaining prefetched packets */
>
>             for (; j < nb_rx; j++) {
>
>                 l3fwd_simple_forward(pkts_burst[j], portid,
>
>                                 qconf);
>
>             }
>
>
> where the prefetch0() is carried out in multiple split iterations, would
> like to have an insight on whether it makes performance improvement to
> likes of:
>
>
>
>        for (j = 0; j  < nb_rx; j++) {
>
>                 rte_prefetch0(rte_pktmbuf_mtod(
>
>                         pkts_burst[j], void *));
>
>             }
>
>
> and how frequent rte_prefetch() needs to called for the same packet. and
> any mechanisms to call in bulk for 64 packets at once ?
>
>
> thanks
>
> Parikshith
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-05  8:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-05  8:46 [dpdk-dev] rte_prefetch0() performance info Parikshith Chowdaiah
2015-03-05  8:51 ` Anuj Kalia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).