From: "Morten Brørup" <mb@smartsharesystems.com>
To: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
Bruce Richardson <bruce.richardson@intel.com>,
dev@dpdk.org
Cc: "Morten Brørup" <mb@smartsharesystems.com>
Subject: [PATCH v3 2/4] mempool perf test: test default mempool with cache
Date: Tue, 1 Apr 2025 15:02:12 +0000 [thread overview]
Message-ID: <20250401150214.4989-3-mb@smartsharesystems.com> (raw)
In-Reply-To: <20250401150214.4989-1-mb@smartsharesystems.com>
Added test for the "default" mempool with cache.
Skip the tests for the "default" mempool, if it happens to use the same
driver (i.e. operations) as already tested.
Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
app/test/test_mempool_perf.c | 84 +++++++++++++++++++++++++-----------
1 file changed, 59 insertions(+), 25 deletions(-)
diff --git a/app/test/test_mempool_perf.c b/app/test/test_mempool_perf.c
index d4271a5ef9..3594d81888 100644
--- a/app/test/test_mempool_perf.c
+++ b/app/test/test_mempool_perf.c
@@ -354,7 +354,10 @@ do_all_mempool_perf_tests(unsigned int cores)
{
struct rte_mempool *mp_cache = NULL;
struct rte_mempool *mp_nocache = NULL;
- struct rte_mempool *default_pool = NULL;
+ struct rte_mempool *default_pool_cache = NULL;
+ struct rte_mempool *default_pool_nocache = NULL;
+ const char *mp_cache_ops;
+ const char *mp_nocache_ops;
const char *default_pool_ops;
int ret = -1;
@@ -368,6 +371,7 @@ do_all_mempool_perf_tests(unsigned int cores)
printf("cannot allocate mempool (without cache)\n");
goto err;
}
+ mp_nocache_ops = rte_mempool_get_ops(mp_nocache->ops_index)->name;
/* create a mempool (with cache) */
mp_cache = rte_mempool_create("perf_test_cache", MEMPOOL_SIZE,
@@ -380,47 +384,76 @@ do_all_mempool_perf_tests(unsigned int cores)
printf("cannot allocate mempool (with cache)\n");
goto err;
}
+ mp_cache_ops = rte_mempool_get_ops(mp_cache->ops_index)->name;
default_pool_ops = rte_mbuf_best_mempool_ops();
- /* Create a mempool based on Default handler */
- default_pool = rte_mempool_create_empty("default_pool",
- MEMPOOL_SIZE,
- MEMPOOL_ELT_SIZE,
- 0, 0,
- SOCKET_ID_ANY, 0);
-
- if (default_pool == NULL) {
- printf("cannot allocate %s mempool\n", default_pool_ops);
+
+ /* Create a mempool (without cache) based on Default handler */
+ default_pool_nocache = rte_mempool_create_empty("default_pool_nocache",
+ MEMPOOL_SIZE,
+ MEMPOOL_ELT_SIZE,
+ 0, 0,
+ SOCKET_ID_ANY, 0);
+ if (default_pool_nocache == NULL) {
+ printf("cannot allocate %s mempool (without cache)\n", default_pool_ops);
goto err;
}
-
- if (rte_mempool_set_ops_byname(default_pool, default_pool_ops, NULL)
- < 0) {
+ if (rte_mempool_set_ops_byname(default_pool_nocache, default_pool_ops, NULL) < 0) {
printf("cannot set %s handler\n", default_pool_ops);
goto err;
}
-
- if (rte_mempool_populate_default(default_pool) < 0) {
+ if (rte_mempool_populate_default(default_pool_nocache) < 0) {
printf("cannot populate %s mempool\n", default_pool_ops);
goto err;
}
+ rte_mempool_obj_iter(default_pool_nocache, my_obj_init, NULL);
+
+ /* Create a mempool (with cache) based on Default handler */
+ default_pool_cache = rte_mempool_create_empty("default_pool_cache",
+ MEMPOOL_SIZE,
+ MEMPOOL_ELT_SIZE,
+ RTE_MEMPOOL_CACHE_MAX_SIZE, 0,
+ SOCKET_ID_ANY, 0);
+ if (default_pool_cache == NULL) {
+ printf("cannot allocate %s mempool (with cache)\n", default_pool_ops);
+ goto err;
+ }
+ if (rte_mempool_set_ops_byname(default_pool_cache, default_pool_ops, NULL) < 0) {
+ printf("cannot set %s handler\n", default_pool_ops);
+ goto err;
+ }
+ if (rte_mempool_populate_default(default_pool_cache) < 0) {
+ printf("cannot populate %s mempool\n", default_pool_ops);
+ goto err;
+ }
+ rte_mempool_obj_iter(default_pool_cache, my_obj_init, NULL);
- rte_mempool_obj_iter(default_pool, my_obj_init, NULL);
-
- printf("start performance test (without cache)\n");
+ printf("start performance test (using %s, without cache)\n",
+ mp_nocache_ops);
if (do_one_mempool_test(mp_nocache, cores, 0) < 0)
goto err;
- printf("start performance test for %s (without cache)\n",
- default_pool_ops);
- if (do_one_mempool_test(default_pool, cores, 0) < 0)
- goto err;
+ if (strcmp(default_pool_ops, mp_nocache_ops) != 0) {
+ printf("start performance test for %s (without cache)\n",
+ default_pool_ops);
+ if (do_one_mempool_test(default_pool_nocache, cores, 0) < 0)
+ goto err;
+ }
- printf("start performance test (with cache)\n");
+ printf("start performance test (using %s, with cache)\n",
+ mp_cache_ops);
if (do_one_mempool_test(mp_cache, cores, 0) < 0)
goto err;
- printf("start performance test (with user-owned cache)\n");
+ if (strcmp(default_pool_ops, mp_cache_ops) != 0) {
+ printf("start performance test for %s (with cache)\n",
+ default_pool_ops);
+ if (do_one_mempool_test(default_pool_cache, cores, 0) < 0)
+ goto err;
+ }
+
+ printf("start performance test (using %s, with user-owned cache)\n",
+ mp_nocache_ops);
if (do_one_mempool_test(mp_nocache, cores, 1) < 0)
goto err;
@@ -431,7 +464,8 @@ do_all_mempool_perf_tests(unsigned int cores)
err:
rte_mempool_free(mp_cache);
rte_mempool_free(mp_nocache);
- rte_mempool_free(default_pool);
+ rte_mempool_free(default_pool_cache);
+ rte_mempool_free(default_pool_nocache);
return ret;
}
--
2.43.0
next prev parent reply other threads:[~2025-04-01 15:02 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-28 16:48 [PATCH] mempool perf test: test random bulk sizes Morten Brørup
2025-03-13 8:23 ` Morten Brørup
2025-03-25 7:15 ` Morten Brørup
2025-03-30 8:29 ` Andrew Rybchenko
2025-03-30 8:57 ` Morten Brørup
2025-03-31 10:03 ` [PATCH v2 0/4] " Morten Brørup
2025-03-31 10:03 ` [PATCH v2 1/4] mempool perf test: replace bare unsigned with unsigned int Morten Brørup
2025-03-31 10:03 ` [PATCH v2 2/4] mempool perf test: test default mempool with cache Morten Brørup
2025-03-31 10:03 ` [PATCH v2 3/4] mempool perf test: improve output readability Morten Brørup
2025-03-31 10:03 ` [PATCH v2 4/4] mempool perf test: test random bulk sizes Morten Brørup
2025-03-31 14:48 ` Andrew Rybchenko
2025-04-02 9:07 ` Morten Brørup
2025-03-31 14:48 ` [PATCH v2 0/4] " Andrew Rybchenko
2025-04-01 15:00 ` Morten Brørup
2025-04-01 15:00 ` [PATCH v2 1/4] mempool perf test: replace bare unsigned with unsigned int Morten Brørup
2025-04-01 15:00 ` [PATCH v2 2/4] mempool perf test: test default mempool with cache Morten Brørup
2025-04-01 15:00 ` [PATCH v2 3/4] mempool perf test: improve output readability Morten Brørup
2025-04-01 15:00 ` [PATCH v2 4/4] mempool perf test: test random bulk sizes Morten Brørup
2025-04-01 15:02 ` [PATCH v3 0/4] " Morten Brørup
2025-04-01 15:02 ` [PATCH v3 1/4] mempool perf test: replace bare unsigned with unsigned int Morten Brørup
2025-04-01 15:02 ` Morten Brørup [this message]
2025-04-01 15:02 ` [PATCH v3 3/4] mempool perf test: improve output readability Morten Brørup
2025-04-01 15:02 ` [PATCH v3 4/4] mempool perf test: test random bulk sizes Morten Brørup
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=20250401150214.4989-3-mb@smartsharesystems.com \
--to=mb@smartsharesystems.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=bruce.richardson@intel.com \
--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;
as well as URLs for NNTP newsgroup(s).