DPDK patches and discussions
 help / color / mirror / Atom feed
From: Olivier Matz <olivier.matz@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] test/mempool: decrease size of requested mempool
Date: Thu,  9 Jul 2015 11:01:29 +0200	[thread overview]
Message-ID: <1436432489-31161-1-git-send-email-olivier.matz@6wind.com> (raw)

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

             reply	other threads:[~2015-07-09  9:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-09  9:01 Olivier Matz [this message]
2015-07-09 11:18 ` Bruce Richardson
2015-07-09 15:35   ` Thomas Monjalon

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=1436432489-31161-1-git-send-email-olivier.matz@6wind.com \
    --to=olivier.matz@6wind.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).