14/10/2025 14:03, Thomas Monjalon: > 14/10/2025 11:59, Morten Brørup: > > From: Thomas Monjalon [mailto:[email protected]] > > > @@ -667,6 +672,7 @@ rte_mbuf_raw_free(struct rte_mbuf *m) > > > { > > > __rte_mbuf_raw_sanity_check(m); > > > rte_mempool_put(m->pool, m); > > > + rte_mbuf_history_mark(m, RTE_MBUF_HISTORY_OP_LIB_FREE); > > > > Fix: For improved race protection, mark the mbuf before actually freeing > > it, like this: > > __rte_mbuf_raw_sanity_check(m); > > + rte_mbuf_history_mark(m, RTE_MBUF_HISTORY_OP_LIB_FREE); > > rte_mempool_put(m->pool, m); > > The race is about a debugging mark. > The benefit of marking after is that the last mark is the upper level, > so we can easily distinguish between a free initiated by the app or the PMD.
I've messed up with another consideration. Here we are in the mbuf lib, so the lowest level. You're right it is better to mark RTE_MBUF_HISTORY_OP_LIB_FREE before freeing effectively.

