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 for this case the list of pre-allocated files is not used.
This patch should mitigate, if not solve, bug #3774:
https://bugs.linaro.org/show_bug.cgi?id=3774
To pre-allocate huge pages, define the environment variable
ODP_HP_CACHE, and possibly set it to the number of huge pages that
should be pre-allocated, setting it to -1 will reserve up to 32 huge
pages, which is currently a hard-coded limit.
example usage:
ODP_HP_CACHE=-1 ./test/validation/api/shmem/shmem_main
Signed-off-by: Josep Puigdemont josep.puigdem...@linaro.org

----------------github------------------------
/** Email created from pull request 685 (joseppc:fix/cache_huge_pages)
 ** https://github.com/Linaro/odp/pull/685
 ** Patch: https://github.com/Linaro/odp/pull/685.patch
 ** Base sha: 6d48d7f7f684b8aa87f7eb4f922d45be345ed771
 ** Merge commit sha: 72e8f7c6b712af7da295dbcf41b222e016ee5cc4
 **/
----------------/github------------------------

----------------checkpatch.pl------------------------
total: 0 errors, 0 warnings, 0 checks, 308 lines checked


to_send-p-000.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 134 lines checked


to_send-p-001.patch has no obvious style problems and is ready for submission.
----------------/checkpatch.pl------------------------

Reply via email to