aboutsummaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2018-11-09 12:17:28 +0200
committerMaxim Uvarov <maxim.uvarov@linaro.org>2018-11-14 10:54:31 +0300
commit901de0794779a6f419f5229de045bf610ec2adc2 (patch)
tree271f70b12a30f296f7f7cb8e5d217079d1d7af72 /platform
parent33c034c005f686cda95bc21ca4ed1aaf6d7eb539 (diff)
linux-gen: ishm: allocate small shm blocks using normal pages
Only memory reservations larger than ISHM_HUGE_PAGE_LIMIT (64kB) are allocated using huge pages (if available). Smaller reservations are done using normal pages to conserve 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>
Diffstat (limited to 'platform')
-rw-r--r--platform/linux-generic/odp_ishm.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/platform/linux-generic/odp_ishm.c b/platform/linux-generic/odp_ishm.c
index 054ef6a0f..9bf40eb35 100644
--- a/platform/linux-generic/odp_ishm.c
+++ b/platform/linux-generic/odp_ishm.c
@@ -126,6 +126,13 @@
#define ISHM_NB_FRAGMNTS (ISHM_MAX_NB_BLOCKS * 2 + 1)
/*
+ * Memory reservations larger than ISHM_HUGE_PAGE_LIMIT (bytes) are allocated
+ * using huge pages (if available). Smaller reservations are done using normal
+ * pages to conserve memory.
+ */
+#define ISHM_HUGE_PAGE_LIMIT (64 * 1024)
+
+/*
* when a memory block is to be exported outside its ODP instance,
* an block 'attribute file' is created in /dev/shm/odp-<pid>-shm-<name>.
* The information given in this file is according to the following:
@@ -1092,7 +1099,7 @@ int _odp_ishm_reserve(const char *name, uint64_t size, int fd,
/* Otherwise, Try first huge pages when possible and needed: */
if ((fd < 0) && page_hp_size && ((flags & _ODP_ISHM_USE_HP) ||
- size > page_sz)) {
+ size > ISHM_HUGE_PAGE_LIMIT)) {
/* at least, alignment in VA should match page size, but user
* can request more: If the user requirement exceeds the page
* size then we have to make sure the block will be mapped at