diff --git a/lib/env_dpdk/init.c b/lib/env_dpdk/init.c index 95a6371de..2625a8290 100644 --- a/lib/env_dpdk/init.c +++ b/lib/env_dpdk/init.c @@ -291,33 +291,41 @@ build_eal_cmdline(const struct spdk_env_opts *opts) } } - /* create just one hugetlbfs file */ - if (opts->hugepage_single_segments) { - args = push_arg(args, &argcount, _sprintf_alloc("--single-file-segments")); - if (args == NULL) { + if (opts->env_context && strstr(opts->env_context, "--no-huge") != NULL) { + if (opts->hugepage_single_segments || opts->unlink_hugepage || opts->hugedir) { + fprintf(stderr, "--no-huge invalid with other hugepage options\n"); + free_args(args, argcount); return -1; } - } - - /* unlink hugepages after initialization */ - /* Note: Automatically unlink hugepage when shm_id < 0, since it means we're not using - * multi-process so we don't need the hugepage links anymore. But we need to make sure - * we don't specify --huge-unlink implicitly if --single-file-segments was specified since - * DPDK doesn't support that. - */ - if (opts->unlink_hugepage || - (opts->shm_id < 0 && !opts->hugepage_single_segments)) { - args = push_arg(args, &argcount, _sprintf_alloc("--huge-unlink")); - if (args == NULL) { - return -1; + } else { + /* create just one hugetlbfs file */ + if (opts->hugepage_single_segments) { + args = push_arg(args, &argcount, _sprintf_alloc("--single-file-segments")); + if (args == NULL) { + return -1; + } } - } - /* use a specific hugetlbfs mount */ - if (opts->hugedir) { - args = push_arg(args, &argcount, _sprintf_alloc("--huge-dir=%s", opts->hugedir)); - if (args == NULL) { - return -1; + /* unlink hugepages after initialization */ + /* Note: Automatically unlink hugepage when shm_id < 0, since it means we're not using + * multi-process so we don't need the hugepage links anymore. But we need to make sure + * we don't specify --huge-unlink implicitly if --single-file-segments was specified since + * DPDK doesn't support that. + */ + if (opts->unlink_hugepage || + (opts->shm_id < 0 && !opts->hugepage_single_segments)) { + args = push_arg(args, &argcount, _sprintf_alloc("--huge-unlink")); + if (args == NULL) { + return -1; + } + } + + /* use a specific hugetlbfs mount */ + if (opts->hugedir) { + args = push_arg(args, &argcount, _sprintf_alloc("--huge-dir=%s", opts->hugedir)); + if (args == NULL) { + return -1; + } } }