[dpdk-dev] [PATCH 15/15] mbuf: move pool pointer in hotterfirst half

Morten Brørup mb at smartsharesystems.com
Thu Nov 5 10:35:45 CET 2020


There is a simple alternative for applications with a single mbuf pool to avoid accessing m->pool.

We could add a global variable pointing to the single mbuf pool.

It would be NULL by default.

It would be set by rte_pktmbuf_pool_create() on first invocation, and reset back to NULL on following invocations. (There would need to be a counter too, to prevent setting it again on the third invocation.)

All functions accessing m->pool would use the global mbuf pool pointer if set, and otherwise use the m->pool pointer, like this:

- rte_mempool_put(m->pool, m);
+ rte_mempool_put(global_mbuf_pool ? global_mbuf_pool : m->pool, m);

This optimization can be implemented without ABI breakage:

Since m->pool is initialized as always, functions that are not modified to use the global_mbuf_pool will simply continue using m->pool, not knowing that a global mbuf pool exists.


Med venlig hilsen / kind regards
- Morten Brørup


More information about the dev mailing list