diff options
author | Josep Puigdemont <josep.puigdemont@linaro.org> | 2018-08-27 16:37:15 +0200 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2018-09-12 17:36:54 +0300 |
commit | c46f54d8c708d6335b0288ff4a5aad3a3b93e41c (patch) | |
tree | bf99c3a8c141668c43162ab8bd7077b20615b96c /config | |
parent | 0b9a1a2e8334581126d4ece3fb4f9e019d88da0d (diff) |
linux-gen: ishm: implement huge page cache
With this patch, ODP will pre-allocate several huge pages at init
time. When memory is to be mapped into a huge page, one that was
pre-allocated will be used, if available, this way ODP won't have to
trap into the kernel to allocate huge pages.
The idea with this implementation is to trick ishm into thinking that
a file descriptor where to map the memory was provided, this way it
it won't try to allocate one itself. This file descriptor is one of
those previously allocated at init time. When the system is done with
this file descriptor, instead of closing it, it is put back into the
list of available huge pages, ready to be reused.
A collateral effect of this patch is that memory is not zeroed out
when it is reused.
WARNING: This patch will not work when using process mode threads.
For several reasons, this may not work when using ODP_ISHM_SINGLE_VA
either, so when this flag is set, the list of pre-allocated files is
not used.
By default ODP will not reserve any huge pages, to tell ODP to do that,
update the ODP configuration file with something like this:
shm: {
num_cached_hp = 32
}
Example usage:
$ echo odp.config
odp_implementation = "linux-generic"
config_file_version = "0.0.1"
shm: {
num_cached_hp = 32
}
$ ODP_CONFIG_FILE=odp.conf ./test/validation/api/shmem/shmem_main
This patch solves bug #3774:
https://bugs.linaro.org/show_bug.cgi?id=3774
Signed-off-by: Josep Puigdemont <josep.puigdemont@linaro.org>
Reviewed-and-tested-by: Matias Elo <matias.elo@nokia.com>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'config')
-rw-r--r-- | config/odp-linux-generic.conf | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/config/odp-linux-generic.conf b/config/odp-linux-generic.conf index 85d5414ba..0dd2a6c13 100644 --- a/config/odp-linux-generic.conf +++ b/config/odp-linux-generic.conf @@ -18,6 +18,17 @@ odp_implementation = "linux-generic" config_file_version = "0.0.1" +# Internal shared memory allocator +shm: { + # ODP will try to reserve as many huge pages as the number indicated + # here, up to 64. A zero value means that no pages should be reserved. + # When using process mode threads, this value should be set to 0 + # because the current implementation won't work properly otherwise. + # These pages will only be freed when the application calls + # odp_term_global(). + num_cached_hp = 0 +} + # DPDK pktio options pktio_dpdk: { # Default options |