[PATCH 1/1] ring: safe partial ordering for head/tail update

Ola Liljedahl Ola.Liljedahl at arm.com
Wed Sep 24 10:51:33 CEST 2025


> On 2025-09-24, 09:50, "Konstantin Ananyev" <konstantin.ananyev at huawei.com <mailto:konstantin.ananyev at huawei.com>> wrote:
> > Sure, I am talking about MT scenario.
> > I think I already provided an example: DPDK mempool library (see below).
> > In brief, It works like that:
> > At init it allocates ring of N memory buffers and ring big enough to hold all of them.
>
> Sorry, I meant to say: "it allocates N memory buffers and ring big enough to hold all of them".
>
> > Then it enqueues all allocated memory buffers into the ring.
> > mempool_get - retrieves (dequeues) buffers from the ring.
> > mempool_put - puts them back (enqueues) to the ring
> > get() might fail (ENOMEM), while put is expected to always succeed.
But how does the thread which calls mempool_put() get hold of the memory buffers that
were obtained using mempool_get() by some other thread? Or this is not the scenario you
are worrying about?
Is it rather that multiple threads independently call mempool_get() and then mempool_put()
on their own buffers? And you are worried that a thread will fail to return (mempool_put) a
buffer that it earlier allocated (mempool_get)? We could create a litmus test for that.

- Ola


IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


More information about the dev mailing list