From patchwork Fri May 29 14:23:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Atkins X-Patchwork-Id: 4980 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id F39825A57; Fri, 29 May 2015 16:25:25 +0200 (CEST) Received: from mx0b-000f0801.pphosted.com (mx0b-000f0801.pphosted.com [67.231.152.113]) by dpdk.org (Postfix) with ESMTP id 6E0F01396 for ; Fri, 29 May 2015 16:25:24 +0200 (CEST) Received: from pps.filterd (m0000700.ppops.net [127.0.0.1]) by mx0b-000f0801.pphosted.com (8.14.7/8.14.7) with SMTP id t4TEMFmk006371 for ; Fri, 29 May 2015 07:25:23 -0700 Received: from hq1wp-exchub01.corp.brocade.com ([144.49.131.13]) by mx0b-000f0801.pphosted.com with ESMTP id 1up839hrjy-1 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT) for ; Fri, 29 May 2015 07:25:23 -0700 Received: from BRMWP-EXCHUB01.corp.brocade.com (172.16.186.99) by HQ1WP-EXCHUB01.corp.brocade.com (10.70.36.101) with Microsoft SMTP Server (TLS) id 14.3.123.3; Fri, 29 May 2015 07:25:21 -0700 Received: from BRMWP-EXMB11.corp.brocade.com (172.16.59.77) by BRMWP-EXCHUB01.corp.brocade.com (172.16.186.99) with Microsoft SMTP Server (TLS) id 14.3.123.3; Fri, 29 May 2015 08:24:08 -0600 Received: from BRA-GXP4P12.vyatta.com (172.27.236.53) by BRMWP-EXMB11.corp.brocade.com (172.16.59.77) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Fri, 29 May 2015 08:24:06 -0600 From: Paul Atkins To: Date: Fri, 29 May 2015 15:23:58 +0100 Message-ID: <1432909438-21329-1-git-send-email-patkins@brocade.com> X-Mailer: git-send-email 1.7.10.4 MIME-Version: 1.0 X-ClientProxiedBy: hq1wp-excas12.corp.brocade.com (10.70.38.22) To BRMWP-EXMB11.corp.brocade.com (172.16.59.77) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.14.151, 1.0.33, 0.0.0000 definitions=2015-05-29_04:2015-05-29, 2015-05-29, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=1 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1505290172 Subject: [dpdk-dev] [PATCH] mem: allow mem size to be specified when no hugetblfs X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 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 --- 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(); }