From 6f5840d2259a38a95be5fb63b19e335a08e0db70 Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Tue, 6 Nov 2018 17:40:11 +0100 Subject: [PATCH] env: remove default pre-reserved memory size Now that we utilize DPDK dynamic memory allocation, we no longer need to set the default pre-reserved memory size. It'll now be 0, which implies all memory will be allocated at runtime. The option to pre-reserve all hugepages on the system is now only available on BSD, so also clarify that bit in the app usage text. Change-Id: I5a8a1d9bf14ad6d938532d7e6254a45e4a81bb92 Signed-off-by: Darek Stojaczyk Reviewed-on: https://review.gerrithub.io/432204 Chandler-Test-Pool: SPDK Automated Test System Tested-by: SPDK CI Jenkins Reviewed-by: Seth Howell Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- app/vhost/vhost.c | 14 ++------------ examples/nvme/fio_plugin/fio_plugin.c | 2 +- examples/nvme/identify/identify.c | 2 +- lib/event/app.c | 9 ++++++--- lib/rocksdb/env_spdk.cc | 1 - test/bdev/bdevperf/bdevperf.c | 1 - test/blobfs/fuse/fuse.c | 1 - test/blobfs/mkfs/mkfs.c | 1 - test/env/vtophys/vtophys.c | 1 - test/event/event_perf/event_perf.c | 1 - test/nvme/aer/aer.c | 1 - test/nvme/err_injection/err_injection.c | 1 - 12 files changed, 10 insertions(+), 25 deletions(-) diff --git a/app/vhost/vhost.c b/app/vhost/vhost.c index da58e34bc7..838211b087 100644 --- a/app/vhost/vhost.c +++ b/app/vhost/vhost.c @@ -38,19 +38,8 @@ #include "spdk/vhost.h" - -#define SPDK_VHOST_DEFAULT_MEM_SIZE 1024 - static const char *g_pid_path = NULL; -static void -vhost_app_opts_init(struct spdk_app_opts *opts) -{ - spdk_app_opts_init(opts); - opts->name = "vhost"; - opts->mem_size = SPDK_VHOST_DEFAULT_MEM_SIZE; -} - static void vhost_usage(void) { @@ -97,7 +86,8 @@ main(int argc, char *argv[]) struct spdk_app_opts opts = {}; int rc; - vhost_app_opts_init(&opts); + spdk_app_opts_init(&opts); + opts.name = "vhost"; if ((rc = spdk_app_parse_args(argc, argv, &opts, "f:S:", NULL, vhost_parse_arg, vhost_usage)) != diff --git a/examples/nvme/fio_plugin/fio_plugin.c b/examples/nvme/fio_plugin/fio_plugin.c index bb6a776d47..8677e2a96f 100644 --- a/examples/nvme/fio_plugin/fio_plugin.c +++ b/examples/nvme/fio_plugin/fio_plugin.c @@ -861,7 +861,7 @@ static struct fio_option options[] = { .lname = "Memory size in MB", .type = FIO_OPT_INT, .off1 = offsetof(struct spdk_fio_options, mem_size), - .def = "512", + .def = "0", .help = "Memory Size for SPDK (MB)", .category = FIO_OPT_C_ENGINE, .group = FIO_OPT_G_INVALID, diff --git a/examples/nvme/identify/identify.c b/examples/nvme/identify/identify.c index 3958483b08..d4f10e0e8b 100644 --- a/examples/nvme/identify/identify.c +++ b/examples/nvme/identify/identify.c @@ -84,7 +84,7 @@ static bool g_hex_dump = false; static int g_shm_id = -1; -static int g_dpdk_mem = 64; +static int g_dpdk_mem = 0; static int g_master_core = 0; diff --git a/lib/event/app.c b/lib/event/app.c index 012e2920b0..a1f628ad45 100644 --- a/lib/event/app.c +++ b/lib/event/app.c @@ -714,10 +714,13 @@ usage(void (*app_usage)(void)) printf(" -p, --master-core master (primary) core for DPDK\n"); printf(" -r, --rpc-socket RPC listen address (default %s)\n", SPDK_DEFAULT_RPC_ADDR); printf(" -s, --mem-size memory size in MB for DPDK (default: "); - if (g_default_opts.mem_size > 0) { - printf("%dMB)\n", g_default_opts.mem_size); - } else { +#ifndef __linux__ + if (g_default_opts.mem_size <= 0) { printf("all hugepage memory)\n"); + } else +#endif + { + printf("%dMB)\n", g_default_opts.mem_size); } printf(" --silence-noticelog disable notice level logging to stderr\n"); printf(" -u, --no-pci disable PCI access\n"); diff --git a/lib/rocksdb/env_spdk.cc b/lib/rocksdb/env_spdk.cc index 63c979eb97..8179fc4956 100644 --- a/lib/rocksdb/env_spdk.cc +++ b/lib/rocksdb/env_spdk.cc @@ -700,7 +700,6 @@ SpdkEnv::SpdkEnv(Env *base_env, const std::string &dir, const std::string &conf, spdk_app_opts_init(opts); opts->name = "rocksdb"; opts->config_file = mConfig.c_str(); - opts->mem_size = 1024 + cache_size_in_mb; opts->shutdown_cb = spdk_rocksdb_shutdown; spdk_fs_set_cache_size(cache_size_in_mb); diff --git a/test/bdev/bdevperf/bdevperf.c b/test/bdev/bdevperf/bdevperf.c index 1416ea2787..f6523afa41 100644 --- a/test/bdev/bdevperf/bdevperf.c +++ b/test/bdev/bdevperf/bdevperf.c @@ -865,7 +865,6 @@ main(int argc, char **argv) opts.name = "bdevperf"; opts.rpc_addr = NULL; opts.reactor_mask = NULL; - opts.mem_size = 1024; opts.shutdown_cb = spdk_bdevperf_shutdown_cb; /* default value */ diff --git a/test/blobfs/fuse/fuse.c b/test/blobfs/fuse/fuse.c index 9d11dfa077..ad1bcf26ec 100644 --- a/test/blobfs/fuse/fuse.c +++ b/test/blobfs/fuse/fuse.c @@ -333,7 +333,6 @@ int main(int argc, char **argv) opts.name = "spdk_fuse"; opts.config_file = argv[1]; opts.reactor_mask = "0x3"; - opts.mem_size = 6144; opts.shutdown_cb = spdk_fuse_shutdown; g_bdev_name = argv[2]; diff --git a/test/blobfs/mkfs/mkfs.c b/test/blobfs/mkfs/mkfs.c index 0bedd84a4f..e618ef0d3e 100644 --- a/test/blobfs/mkfs/mkfs.c +++ b/test/blobfs/mkfs/mkfs.c @@ -132,7 +132,6 @@ int main(int argc, char **argv) opts.name = "spdk_mkfs"; opts.config_file = argv[1]; opts.reactor_mask = "0x3"; - opts.mem_size = 1024; opts.shutdown_cb = NULL; spdk_fs_set_cache_size(512); diff --git a/test/env/vtophys/vtophys.c b/test/env/vtophys/vtophys.c index d672b1aef3..bb4975db13 100644 --- a/test/env/vtophys/vtophys.c +++ b/test/env/vtophys/vtophys.c @@ -119,7 +119,6 @@ main(int argc, char **argv) spdk_env_opts_init(&opts); opts.name = "vtophys"; opts.core_mask = "0x1"; - opts.mem_size = 256; if (spdk_env_init(&opts) < 0) { printf("Err: Unable to initialize SPDK env\n"); return 1; diff --git a/test/event/event_perf/event_perf.c b/test/event/event_perf/event_perf.c index 917ea9504e..2a4f8a2b0c 100644 --- a/test/event/event_perf/event_perf.c +++ b/test/event/event_perf/event_perf.c @@ -144,7 +144,6 @@ main(int argc, char **argv) int rc = 0; opts.name = "event_perf"; - opts.mem_size = 256; g_time_in_sec = 0; diff --git a/test/nvme/aer/aer.c b/test/nvme/aer/aer.c index e102813fb2..416f93f935 100644 --- a/test/nvme/aer/aer.c +++ b/test/nvme/aer/aer.c @@ -523,7 +523,6 @@ int main(int argc, char **argv) spdk_env_opts_init(&opts); opts.name = "aer"; opts.core_mask = "0x1"; - opts.mem_size = 64; if (spdk_env_init(&opts) < 0) { fprintf(stderr, "Unable to initialize SPDK env\n"); return 1; diff --git a/test/nvme/err_injection/err_injection.c b/test/nvme/err_injection/err_injection.c index 50d67092c1..0ae45d6970 100644 --- a/test/nvme/err_injection/err_injection.c +++ b/test/nvme/err_injection/err_injection.c @@ -219,7 +219,6 @@ int main(int argc, char **argv) spdk_env_opts_init(&opts); opts.name = "err_injection"; opts.core_mask = "0x1"; - opts.mem_size = 64; opts.shm_id = 0; if (spdk_env_init(&opts) < 0) { fprintf(stderr, "Unable to initialize SPDK env\n");