[dpdk-dev] [PATCH] eal: unmap unneed dpdk VA spaces for legacy mem

Lilijun jerry.lilijun at huawei.com
Fri Mar 8 06:38:59 CET 2019


Comparing dpdk VA spaces to dpdk 16.11, the dpdk app process's VA spaces increase to above 30G.
Here we can unmap the unneed VA spaces in rte_memseg_list.

Signed-off-by: Lilijun <jerry.lilijun at huawei.com>
---
 lib/librte_eal/linuxapp/eal/eal_memory.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
index 32feb41..56abdd2 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -1626,8 +1626,19 @@ void numa_error(char *where)
 		if (msl->base_va == NULL)
 			continue;
 		/* skip lists where there is at least one page allocated */
-		if (msl->memseg_arr.count > 0)
+		if (msl->memseg_arr.count > 0) {
+			if (internal_config.legacy_mem) {
+				struct rte_fbarray *arr = &msl->memseg_arr;
+				int idx = rte_fbarray_find_next_free(arr, 0);
+
+				while (idx >= 0) {
+					void *va = (void*)((char*)msl->base_va + idx * msl->page_sz);
+					munmap(va, msl->page_sz);
+					idx = rte_fbarray_find_next_free(arr, idx + 1);
+				}
+			}
 			continue;
+		}
 		/* this is an unused list, deallocate it */
 		mem_sz = msl->len;
 		munmap(msl->base_va, mem_sz);
-- 
1.8.3.1




More information about the dev mailing list