DPDK patches and discussions
 help / color / mirror / Atom feed
From: Paul Atkins <patkins@brocade.com>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH] mem: allow mem size to be specified when no hugetblfs
Date: Fri, 29 May 2015 15:23:58 +0100	[thread overview]
Message-ID: <1432909438-21329-1-git-send-email-patkins@brocade.com> (raw)

The config option to turn off huge table support does not work with
the existing -m option to specify the amount of memory to use.  Add
a new option --no-huge-mem-size <mem in MB> that takes a paramater
to use as the heap size instead of the value specified by
MEMSIZE_IF_NO_HUGE_PAGE.

Signed-off-by: Paul Atkins <patkins@brocade.com>
---
 lib/librte_eal/common/eal_common_options.c |    7 +++++++
 lib/librte_eal/common/eal_internal_cfg.h   |    1 +
 lib/librte_eal/common/eal_options.h        |    2 ++
 lib/librte_eal/linuxapp/eal/eal.c          |    6 +++++-
 4 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 8fcb1ab..8b1f9f0 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -79,6 +79,7 @@ eal_long_options[] = {
 	{OPT_MASTER_LCORE,      1, NULL, OPT_MASTER_LCORE_NUM     },
 	{OPT_NO_HPET,           0, NULL, OPT_NO_HPET_NUM          },
 	{OPT_NO_HUGE,           0, NULL, OPT_NO_HUGE_NUM          },
+	{OPT_NO_HUGE_MEM_SIZE,  1, NULL, OPT_NO_HUGE_MEM_SIZE_NUM },
 	{OPT_NO_PCI,            0, NULL, OPT_NO_PCI_NUM           },
 	{OPT_NO_SHCONF,         0, NULL, OPT_NO_SHCONF_NUM        },
 	{OPT_PCI_BLACKLIST,     1, NULL, OPT_PCI_BLACKLIST_NUM    },
@@ -722,6 +723,11 @@ eal_parse_common_option(int opt, const char *optarg,
 		conf->no_hugetlbfs = 1;
 		break;
 
+	case OPT_NO_HUGE_MEM_SIZE_NUM:
+		conf->no_hugetlbfs_mem_size = atoi(optarg);
+		conf->no_hugetlbfs_mem_size *= 1024ULL * 1024ULL;
+		break;
+
 	case OPT_NO_PCI_NUM:
 		conf->no_pci = 1;
 		break;
@@ -907,6 +913,7 @@ eal_common_usage(void)
 	       "  -h, --help          This help\n"
 	       "\nEAL options for DEBUG use only:\n"
 	       "  --"OPT_NO_HUGE"           Use malloc instead of hugetlbfs\n"
+	       "  --"OPT_NO_HUGE_MEM_SIZE"  Heap size when no hugetblfs\n"
 	       "  --"OPT_NO_PCI"            Disable PCI\n"
 	       "  --"OPT_NO_HPET"           Disable HPET\n"
 	       "  --"OPT_NO_SHCONF"         No shared config (mmap'd files)\n"
diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h
index e2ecb0d..f1a2a7d 100644
--- a/lib/librte_eal/common/eal_internal_cfg.h
+++ b/lib/librte_eal/common/eal_internal_cfg.h
@@ -64,6 +64,7 @@ struct internal_config {
 	volatile unsigned force_nchannel; /**< force number of channels */
 	volatile unsigned force_nrank;    /**< force number of ranks */
 	volatile unsigned no_hugetlbfs;   /**< true to disable hugetlbfs */
+	volatile unsigned no_hugetlbfs_mem_size; /**< mem size without hugetlbfs  */
 	volatile unsigned xen_dom0_support; /**< support app running on Xen Dom0*/
 	volatile unsigned no_pci;         /**< true to disable PCI */
 	volatile unsigned no_hpet;        /**< true to disable HPET */
diff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h
index f6714d9..39a0b94 100644
--- a/lib/librte_eal/common/eal_options.h
+++ b/lib/librte_eal/common/eal_options.h
@@ -65,6 +65,8 @@ enum {
 	OPT_NO_HPET_NUM,
 #define OPT_NO_HUGE           "no-huge"
 	OPT_NO_HUGE_NUM,
+#define OPT_NO_HUGE_MEM_SIZE  "no-huge-mem-size"
+	OPT_NO_HUGE_MEM_SIZE_NUM,
 #define OPT_NO_PCI            "no-pci"
 	OPT_NO_PCI_NUM,
 #define OPT_NO_SHCONF         "no-shconf"
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index bd770cf..3528a0e 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -735,7 +735,11 @@ rte_eal_init(int argc, char **argv)
 
 	if (internal_config.memory == 0 && internal_config.force_sockets == 0) {
 		if (internal_config.no_hugetlbfs)
-			internal_config.memory = MEMSIZE_IF_NO_HUGE_PAGE;
+			if (internal_config.no_hugetlbfs_mem_size)
+				internal_config.memory =
+					internal_config.no_hugetlbfs_mem_size;
+			else
+				internal_config.memory = MEMSIZE_IF_NO_HUGE_PAGE;
 		else
 			internal_config.memory = eal_get_hugepage_mem_size();
 	}
-- 
1.7.10.4

             reply	other threads:[~2015-05-29 14:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-29 14:23 Paul Atkins [this message]
2015-06-15 13:54 ` 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=1432909438-21329-1-git-send-email-patkins@brocade.com \
    --to=patkins@brocade.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).