env/app: add unlink hugepages option to app
DPDK has an option "huge-unlink" which can be used to remove mmapped files after EAL initialization, SPDK doesn't enable the option by default, ethier DPDK, while here, export a new parameter which can let user to decide enable it or not. Fix issues #349 and #350. Change-Id: Ic516b9f48f7b1c7c51712cc7bb7475ed904ff24b Signed-off-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-on: https://review.gerrithub.io/419156 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
1e2b25ec20
commit
01831056c5
@ -80,6 +80,7 @@ struct spdk_env_opts {
|
||||
int mem_size;
|
||||
bool no_pci;
|
||||
bool hugepage_single_segments;
|
||||
bool unlink_hugepage;
|
||||
size_t num_pci_addr;
|
||||
struct spdk_pci_addr *pci_blacklist;
|
||||
struct spdk_pci_addr *pci_whitelist;
|
||||
|
@ -104,6 +104,7 @@ struct spdk_app_opts {
|
||||
int mem_size;
|
||||
bool no_pci;
|
||||
bool hugepage_single_segments;
|
||||
bool unlink_hugepage;
|
||||
enum spdk_log_level print_level;
|
||||
size_t num_pci_addr;
|
||||
struct spdk_pci_addr *pci_blacklist;
|
||||
@ -215,7 +216,7 @@ int spdk_app_parse_core_mask(const char *mask, struct spdk_cpuset *cpumask);
|
||||
*/
|
||||
struct spdk_cpuset *spdk_app_get_core_mask(void);
|
||||
|
||||
#define SPDK_APP_GETOPT_STRING "c:de:ghi:m:n:p:qr:s:uwB:L:W:"
|
||||
#define SPDK_APP_GETOPT_STRING "c:de:ghi:m:n:p:qr:s:uwB:L:RW:"
|
||||
|
||||
enum spdk_app_parse_args_rvals {
|
||||
SPDK_APP_PARSE_ARGS_HELP = 0,
|
||||
|
@ -250,6 +250,14 @@ spdk_build_eal_cmdline(const struct spdk_env_opts *opts)
|
||||
}
|
||||
}
|
||||
|
||||
/* unlink hugepages after initialization */
|
||||
if (opts->unlink_hugepage) {
|
||||
args = spdk_push_arg(args, &argcount, _sprintf_alloc("--huge-unlink"));
|
||||
if (args == NULL) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (opts->num_pci_addr) {
|
||||
size_t i;
|
||||
char bdf[32];
|
||||
|
@ -420,6 +420,7 @@ spdk_app_setup_env(struct spdk_app_opts *opts)
|
||||
env_opts.master_core = opts->master_core;
|
||||
env_opts.mem_size = opts->mem_size;
|
||||
env_opts.hugepage_single_segments = opts->hugepage_single_segments;
|
||||
env_opts.unlink_hugepage = opts->unlink_hugepage;
|
||||
env_opts.no_pci = opts->no_pci;
|
||||
env_opts.num_pci_addr = opts->num_pci_addr;
|
||||
env_opts.pci_blacklist = opts->pci_blacklist;
|
||||
@ -645,6 +646,7 @@ usage(void (*app_usage)(void))
|
||||
printf(" -u disable PCI access.\n");
|
||||
printf(" -w wait for RPCs to initialize subsystems\n");
|
||||
printf(" -B addr pci addr to blacklist\n");
|
||||
printf(" -R unlink huge files after initialization\n");
|
||||
printf(" -W addr pci addr to whitelist (-B and -W cannot be used at the same time)\n");
|
||||
spdk_tracelog_usage(stdout, "-L");
|
||||
if (app_usage) {
|
||||
@ -793,6 +795,9 @@ spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts,
|
||||
opts->print_level = SPDK_LOG_DEBUG;
|
||||
break;
|
||||
#endif
|
||||
case 'R':
|
||||
opts->unlink_hugepage = true;
|
||||
break;
|
||||
case 'W':
|
||||
if (opts->pci_blacklist) {
|
||||
free(opts->pci_blacklist);
|
||||
|
Loading…
x
Reference in New Issue
Block a user