From: Lilijun Subject: [PATCH] eal: unmap unneed dpdk VA spaces for legacy mem Date: Fri, 8 Mar 2019 13:38:59 +0800 Message-ID: <20190308053859.19980-1-jerry.lilijun@huawei.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , , Lilijun To: Return-path: Received: from huawei.com (szxga06-in.huawei.com [45.249.212.32]) by dpdk.org (Postfix) with ESMTP id 43DBDA3 for ; Fri, 8 Mar 2019 06:40:19 +0100 (CET) Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 27C45BD56ED871FA79F8 for ; Fri, 8 Mar 2019 13:40:17 +0800 (CST) List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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