From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Robert Sanford" <rsanford2@gmail.com>, <dev@dpdk.org>
Cc: <andrew.rybchenko@oktetlabs.ru>, <olivier.matz@6wind.com>,
"Robert Sanford" <rsanford@akamai.com>, <stable@dpdk.org>
Subject: RE: [PATCH v2 2/3] mempool: fix dump of unpopulated pool
Date: Fri, 6 Nov 2026 09:43:47 +0100 [thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35F65AFD@smartserver.smartshare.dk> (raw)
In-Reply-To: <20261103173543.130142-3-rsanford2@gmail.com>
Good progress, Robert.
One more change requested, see comments inline below.
> +/*
> + * Check whether the mempool driver has allocated its store. Mempools
> are on
> + * the mempool list before that, so rte_mempool_dump() and
> rte_mempool_walk()
> + * callbacks can find them while another thread populates them.
> + * Acquire: pairs with the release in mempool_ops_alloc_once().
> + */
> +static bool
> +mempool_is_created(const struct rte_mempool *mp)
> +{
> + return (rte_atomic_load_explicit(
> + (const RTE_ATOMIC(unsigned int) *)&mp->flags,
> + rte_memory_order_acquire) &
> + RTE_MEMPOOL_F_POOL_CREATED) != 0;
> +}
mempool_is_created() should be public as rte_mempool_is_created().
Then the rte_mempool_walk() description can refer to it instead of referring to the RTE_MEMPOOL_F_POOL_CREATED flag.
The "Acquire:" comment is an implementation detail; when you make the function public, move that comment away from the function description and into the implementation instead.
About the function name:
When the empty mempool is created, it is assigned the "ring" driver as default.
Until the pool has been populated, it may be assigned a different mempool driver, e.g. the "stack" driver.
I suppose this is why the flag is named CREATED and not POPULATED.
And thus, the name rte_mempool_is_created() remains correct, rather than using a different name.
You may consider this information, if you choose to update the function description.
Notes:
Although the function is short and simple, it is not fast path, so it should remain non-inline.
You already made it non-inline, so I'm just making sure you keep it that way. :-)
It is used by mempool dump, so I don't think it can be marked experimental.
[...]
> * The mempool list is locked while the iterator function runs, so the
> * iterator function must not create or free a mempool.
> *
> + * The iterator function is also called for mempools that are not
> + * populated yet, which do not have RTE_MEMPOOL_F_POOL_CREATED set in
> + * their flags. Such a mempool has no store yet, so the iterator
> function
> + * must check this flag before calling functions that query the
Remember referring to the new rte_mempool_is_created() function in this description.
> mempool
> + * driver, such as rte_mempool_avail_count().
> + *
> * @param func
> * Iterator function
> * @param arg
With the suggested change,
Acked-by: Morten Brørup <mb@smartsharesystems.com>
next prev parent reply other threads:[~2026-11-06 8:43 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 1:11 [PATCH v1 0/3] mempool: fix races between list walk and create/free Robert Sanford
2026-11-03 1:11 ` [PATCH v1 1/3] mempool: fix race between list walk and free Robert Sanford
2026-11-03 13:54 ` Morten Brørup
2026-11-03 1:11 ` [PATCH v1 2/3] mempool: skip unpopulated pools in walk and dump Robert Sanford
2026-11-03 14:12 ` Morten Brørup
2026-11-03 1:11 ` [PATCH v1 3/3] test/mempool: add list walk race test Robert Sanford
2026-11-03 14:15 ` Morten Brørup
2026-11-03 17:35 ` [PATCH v2 0/3] mempool: fix races between list walk and create/free Robert Sanford
2026-11-03 17:35 ` [PATCH v2 1/3] mempool: fix race between list walk and free Robert Sanford
2026-11-03 17:35 ` [PATCH v2 2/3] mempool: fix dump of unpopulated pool Robert Sanford
2026-11-06 8:43 ` Morten Brørup [this message]
2026-11-06 18:43 ` Robert Sanford
2026-11-06 19:24 ` Morten Brørup
2026-11-03 17:35 ` [PATCH v2 3/3] test/mempool: add list walk race test Robert Sanford
2026-11-09 14:40 ` [PATCH v3 0/3] mempool: fix races between list walk and create/free Robert Sanford
2026-11-09 14:40 ` [PATCH v3 1/3] mempool: fix race between list walk and free Robert Sanford
2026-11-09 14:40 ` [PATCH v3 2/3] mempool: fix dump of unpopulated pool Robert Sanford
2026-11-09 14:40 ` [PATCH v3 3/3] test/mempool: add list walk race test Robert Sanford
2026-11-11 13:00 ` Morten Brørup
2026-11-12 15:43 ` [PATCH v4 0/3] mempool: fix races between list walk and create/free Robert Sanford
2026-11-12 15:43 ` [PATCH v4 1/3] mempool: fix race between list walk and free Robert Sanford
2026-11-12 15:43 ` [PATCH v4 2/3] mempool: fix dump of unpopulated pool Robert Sanford
2026-11-12 15:43 ` [PATCH v4 3/3] test/mempool: add list walk race test Robert Sanford
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=98CBD80474FA8B44BF855DF32C47DC35F65AFD@smartserver.smartshare.dk \
--to=mb@smartsharesystems.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=olivier.matz@6wind.com \
--cc=rsanford2@gmail.com \
--cc=rsanford@akamai.com \
--cc=stable@dpdk.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