DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] Accessing 2nd cacheline in rte_pktmbuf_prefree_seg()
@ 2018-02-13 22:45 Yongseok Koh
  2018-02-14  3:16 ` Yongseok Koh
  0 siblings, 1 reply; 7+ messages in thread
From: Yongseok Koh @ 2018-02-13 22:45 UTC (permalink / raw)
  To: Olivier Matz; +Cc: dev

Hi Olivier

I'm wondering why rte_pktmbuf_prefree_seg() checks m->next instead of
m->nb_segs? As 'next' is in the 2nd cacheline, checking nb_segs seems beneficial
to the cases where almost mbufs have single segment.

A customer reported high rate of cache misses in the code and I thought the
following patch could be helpful. I haven't had them try it yet but just wanted
to hear from you.

I'd appreciate if you can review this idea.

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 62740254d..96edbcb9e 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1398,7 +1398,7 @@ rte_pktmbuf_prefree_seg(struct rte_mbuf *m)
                if (RTE_MBUF_INDIRECT(m))
                        rte_pktmbuf_detach(m);
 
-               if (m->next != NULL) {
+               if (m->nb_segs > 1) {
                        m->next = NULL;
                        m->nb_segs = 1;
                }
@@ -1410,7 +1410,7 @@ rte_pktmbuf_prefree_seg(struct rte_mbuf *m)
                if (RTE_MBUF_INDIRECT(m))
                        rte_pktmbuf_detach(m);
 
-               if (m->next != NULL) {
+               if (m->nb_segs > 1) {
                        m->next = NULL;
                        m->nb_segs = 1;
                }

Thanks,
Yongseok

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

end of thread, other threads:[~2018-02-14 14:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-13 22:45 [dpdk-dev] Accessing 2nd cacheline in rte_pktmbuf_prefree_seg() Yongseok Koh
2018-02-14  3:16 ` Yongseok Koh
2018-02-14 11:48   ` Ananyev, Konstantin
2018-02-14 12:03     ` Ananyev, Konstantin
2018-02-14 12:11       ` Bruce Richardson
2018-02-14 12:35         ` Ananyev, Konstantin
2018-02-14 14:16           ` Ananyev, Konstantin

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).