DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] test/mempool: decrease size of requested mempool
@ 2015-07-09  9:01 Olivier Matz
  2015-07-09 11:18 ` Bruce Richardson
  0 siblings, 1 reply; 3+ messages in thread
From: Olivier Matz @ 2015-07-09  9:01 UTC (permalink / raw)
  To: dev

In test application, the default size of allocated mempool is calculated
as following:

  (RTE_MAX_LCORE * (RTE_MEMPOOL_CACHE_MAX_SIZE + max_kept_objects)) - 1

The objective is to ensure that all cores can fill their cache and keep
'max_kept_objects' at the same time. As RTE_MAX_LCORE is 128 and
RTE_MEMPOOL_CACHE_MAX_SIZE is 512 in the default configuration, it can
produce very large mempools (170 MB).

We can replace the number of core by a dynamic value, which drastically
reduces the amount of memory needed for this test (5 MB with 4 cores).

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 app/test/test_mempool.c      | 2 +-
 app/test/test_mempool_perf.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c
index 9eb0d5d..72f8fb6 100644
--- a/app/test/test_mempool.c
+++ b/app/test/test_mempool.c
@@ -75,7 +75,7 @@
 #define TIME_S 5
 #define MEMPOOL_ELT_SIZE 2048
 #define MAX_KEEP 128
-#define MEMPOOL_SIZE ((RTE_MAX_LCORE*(MAX_KEEP+RTE_MEMPOOL_CACHE_MAX_SIZE))-1)
+#define MEMPOOL_SIZE ((rte_lcore_count()*(MAX_KEEP+RTE_MEMPOOL_CACHE_MAX_SIZE))-1)
 
 static struct rte_mempool *mp;
 static struct rte_mempool *mp_cache, *mp_nocache;
diff --git a/app/test/test_mempool_perf.c b/app/test/test_mempool_perf.c
index 1f7539c..cdc02a0 100644
--- a/app/test/test_mempool_perf.c
+++ b/app/test/test_mempool_perf.c
@@ -94,7 +94,7 @@
 #define TIME_S 5
 #define MEMPOOL_ELT_SIZE 2048
 #define MAX_KEEP 128
-#define MEMPOOL_SIZE ((RTE_MAX_LCORE*(MAX_KEEP+RTE_MEMPOOL_CACHE_MAX_SIZE))-1)
+#define MEMPOOL_SIZE ((rte_lcore_count()*(MAX_KEEP+RTE_MEMPOOL_CACHE_MAX_SIZE))-1)
 
 static struct rte_mempool *mp;
 static struct rte_mempool *mp_cache, *mp_nocache;
-- 
2.1.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-07-09 15:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-09  9:01 [dpdk-dev] [PATCH] test/mempool: decrease size of requested mempool Olivier Matz
2015-07-09 11:18 ` Bruce Richardson
2015-07-09 15:35   ` Thomas Monjalon

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).