public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Andrew Rybchenko" <andrew.rybchenko@oktetlabs.ru>, <dev@dpdk.org>
Subject: mempool name size incorrect?
Date: Tue, 10 Mar 2026 15:10:35 +0100	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35F65773@smartserver.smartshare.dk> (raw)

Isn't the RTE_MEMPOOL_NAMESIZE too short?

Looking at the names sizes:

RTE_MEMZONE_NAMESIZE = 32,
RTE_RING_NAMESIZE = RTE_MEMZONE_NAMESIZE - (sizeof("RG_")=4) + 1 = 29,
RTE_MEMPOOL_NAMESIZE = RTE_RING_NAMESIZE - (sizeof("MP_")=4) + 1 = 26

Referring to [1], I think it should be fixed as:
- #define RTE_MEMPOOL_NAMESIZE (RTE_RING_NAMESIZE - \
			      sizeof(RTE_MEMPOOL_MZ_PREFIX) + 1)
+ #define RTE_MEMPOOL_NAMESIZE (RTE_MEMZONE_NAMESIZE - \
			      sizeof(RTE_MEMPOOL_MZ_PREFIX) + 1)

There is no ring involved, so I guess it is some kind of copy-paste-search-replace error.


Looking at the rte_mempool structure [2]:
struct __rte_cache_aligned rte_mempool {
	char name[RTE_MEMPOOL_NAMESIZE]; /**< Name of mempool. */
	union {
		void *pool_data;         /**< Ring or pool to store objects. */
		uint64_t pool_id;        /**< External mempool identifier. */
	};


Due to the 8-byte alignment of the pool_id field following the name field, fixing the length as suggested doesn't change the memory layout for 64 bit CPU architectures.
But it does for 32 bit CPU architectures, which will only 4-byte align the pool_id field.

[1]: https://elixir.bootlin.com/dpdk/v26.03-rc1/source/lib/mempool/rte_mempool.h#L128
[2]: https://elixir.bootlin.com/dpdk/v26.03-rc1/source/lib/mempool/rte_mempool.h#L230


Another thing:
On 32 bit CPU architectures, the cache_size and local_cache fields in the rte_mempool structure are not in the same cache line.
But I guess we don't really care about 32 bit CPU architectures.


Venlig hilsen / Kind regards,
-Morten Brørup


             reply	other threads:[~2026-03-10 14:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10 14:10 Morten Brørup [this message]
2026-03-11  9:46 ` mempool name size incorrect? Andrew Rybchenko
2026-03-11 10:25   ` Morten Brørup
2026-03-11 10:52     ` Konstantin Ananyev
2026-03-11 10:57       ` Andrew Rybchenko
2026-03-11 11:08       ` Morten Brørup
2026-03-11 11:18         ` Konstantin Ananyev
2026-03-11 11:37           ` Morten Brørup
2026-03-12  8:37             ` Konstantin Ananyev
2026-03-11 15:58       ` Stephen Hemminger

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=98CBD80474FA8B44BF855DF32C47DC35F65773@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@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