From 65f2959da164c4fed23b713c99842213c7ab04e1 Mon Sep 17 00:00:00 2001 From: Maxim Uvarov Date: Thu, 13 Sep 2018 22:15:53 +0300 Subject: 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 Reviewed-by: Bill Fischofer --- platform/linux-generic/odp_packet_io.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'platform/linux-generic/odp_packet_io.c') 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 #include #include +#include #include #include @@ -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; } -- cgit v1.2.3