diff options
author | Matias Elo <matias.elo@nokia.com> | 2018-11-01 16:50:43 +0200 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2018-11-14 18:11:24 +0300 |
commit | b181d885962969f439d9cd6f828fb66007ddedcb (patch) | |
tree | 52d3a4f1dcb58cfedf22329a457052e9918a6800 | |
parent | bc9a1f01b55da44053a233acd4110def04f208fe (diff) |
linux-gen: ishm: read single va size from config
Simplify adjusting single VA memory size by moving the value to ODP config
(shm.single_va_size). The default size is dropped to 128MB to save memory.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
-rw-r--r-- | config/odp-linux-generic.conf | 5 | ||||
-rw-r--r-- | platform/linux-generic/include/odp_config_internal.h | 10 | ||||
-rw-r--r-- | platform/linux-generic/odp_ishm.c | 16 | ||||
-rw-r--r-- | platform/linux-generic/test/process-mode.conf | 5 |
4 files changed, 22 insertions, 14 deletions
diff --git a/config/odp-linux-generic.conf b/config/odp-linux-generic.conf index 4585a8964..339382899 100644 --- a/config/odp-linux-generic.conf +++ b/config/odp-linux-generic.conf @@ -16,7 +16,7 @@ # Mandatory fields odp_implementation = "linux-generic" -config_file_version = "0.1.3" +config_file_version = "0.1.4" # Shared memory options shm: { @@ -37,6 +37,9 @@ shm: { # Allocate internal shared memory using a single virtual address space. # Set to 1 to enable using process mode. single_va = 0 + + # Amount of memory pre-reserved for ODP_SHM_SINGLE_VA usage in kilobytes + single_va_size_kb = 131072 } # Pool options diff --git a/platform/linux-generic/include/odp_config_internal.h b/platform/linux-generic/include/odp_config_internal.h index 65f751972..642de685c 100644 --- a/platform/linux-generic/include/odp_config_internal.h +++ b/platform/linux-generic/include/odp_config_internal.h @@ -129,16 +129,6 @@ extern "C" { #define ODP_CONFIG_SHM_BLOCKS (ODP_CONFIG_POOLS + 48) /* - * Size of the virtual address space pre-reserver for ISHM - * - * This is just virtual space preallocation size, not memory allocation. - * This address space is used by ISHM to map things at a common address in - * all ODP threads (when the _ODP_ISHM_SINGLE_VA flag is used). - * In bytes. - */ -#define ODP_CONFIG_ISHM_VA_PREALLOC_SZ (1024 * 1024 * 1024L) - -/* * Maximum event burst size * * This controls the burst size on various enqueue, dequeue, etc calls. Large diff --git a/platform/linux-generic/odp_ishm.c b/platform/linux-generic/odp_ishm.c index da982e183..f8af8f79c 100644 --- a/platform/linux-generic/odp_ishm.c +++ b/platform/linux-generic/odp_ishm.c @@ -1499,11 +1499,23 @@ int _odp_ishm_init_global(const odp_init_t *init) void *addr; void *spce_addr; int i; + int single_va_size_kb = 0; uid_t uid; char *hp_dir = odp_global_ro.hugepage_info.default_huge_page_dir; uint64_t align; - uint64_t max_memory = ODP_CONFIG_ISHM_VA_PREALLOC_SZ; - uint64_t internal = ODP_CONFIG_ISHM_VA_PREALLOC_SZ / 8; + uint64_t max_memory; + uint64_t internal; + + if (!_odp_libconfig_lookup_ext_int("shm", NULL, "single_va_size_kb", + &single_va_size_kb)) { + ODP_ERR("Unable to read single VA size from config\n"); + return -1; + } + + ODP_DBG("Shm single VA size: %dkB\n", single_va_size_kb); + + max_memory = single_va_size_kb * 1024; + internal = max_memory / 8; /* user requested memory size + some extra for internal use */ if (init && init->shm.max_memory) diff --git a/platform/linux-generic/test/process-mode.conf b/platform/linux-generic/test/process-mode.conf index f631f54bc..a86562f6e 100644 --- a/platform/linux-generic/test/process-mode.conf +++ b/platform/linux-generic/test/process-mode.conf @@ -1,10 +1,13 @@ # Mandatory fields odp_implementation = "linux-generic" -config_file_version = "0.1.3" +config_file_version = "0.1.4" # Shared memory options shm: { # Override default option and allocate internal shms using single # virtual address space. single_va = 1 + + # Increase the amount of single VA memory + single_va_size_kb = 1048576 } |