aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/odp_packet_io.c
diff options
context:
space:
mode:
authorMaxim Uvarov <maxim.uvarov@linaro.org>2018-09-13 22:15:53 +0300
committerMaxim Uvarov <maxim.uvarov@linaro.org>2018-10-09 17:28:37 +0300
commit65f2959da164c4fed23b713c99842213c7ab04e1 (patch)
tree187ec3d829049d7299985d24fd3981eecbaa0142 /platform/linux-generic/odp_packet_io.c
parent1d5c2ffab0051390641628a458f657c49ea54d41 (diff)
linux-gen: do not use huge pages for internal allocations
Some linux-generic internal shared memory allocations have to be in normal pages due to small required data. Relaying on odp_sys_huge_page_size() is not really correct, because call returns default huge page size. But default huge page size is definned in kernel boot parameter as: default_hugepagesz=1G hugepagesz=1G hugepages=2 So in that case for small allocation linux-gen will create 1GB huge page. This patch introduces internal flag to shm funtion to allocate hp. This patch remains allowing changes on top of it: For now pools are in huge page. And for apps with small pool it's big overhead of unused memory. We should take into account odp_sys_huge_page_size_all() call and found best sized huge pages. https://bugs.linaro.org/show_bug.cgi?id=3954 Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Diffstat (limited to 'platform/linux-generic/odp_packet_io.c')
-rw-r--r--platform/linux-generic/odp_packet_io.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c
index 91efba1a1..26be844c8 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -29,6 +29,7 @@
#include <odp/api/plat/time_inlines.h>
#include <odp_pcapng.h>
#include <odp/api/plat/queue_inlines.h>
+#include <odp_shm_internal.h>
#include <string.h>
#include <inttypes.h>
@@ -65,9 +66,10 @@ int odp_pktio_init_global(void)
odp_shm_t shm;
int pktio_if;
- shm = odp_shm_reserve("odp_pktio_entries",
+ shm = odp_shm_reserve("_odp_pktio_entries",
sizeof(pktio_table_t),
- sizeof(pktio_entry_t), 0);
+ sizeof(pktio_entry_t),
+ _ODP_SHM_NO_HP);
if (shm == ODP_SHM_INVALID)
return -1;
@@ -1326,9 +1328,9 @@ int odp_pktio_term_global(void)
pktio_if);
}
- ret = odp_shm_free(odp_shm_lookup("odp_pktio_entries"));
+ ret = odp_shm_free(odp_shm_lookup("_odp_pktio_entries"));
if (ret != 0)
- ODP_ERR("shm free failed for odp_pktio_entries");
+ ODP_ERR("shm free failed for _odp_pktio_entries");
return ret;
}