From patchwork Fri Mar 8 05:38:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lilijun (Jerry)" X-Patchwork-Id: 50978 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D7089326C; Fri, 8 Mar 2019 06:40:20 +0100 (CET) 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) Received: from localhost (10.177.20.134) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.408.0; Fri, 8 Mar 2019 13:40:06 +0800 From: Lilijun To: CC: , , Lilijun Date: Fri, 8 Mar 2019 13:38:59 +0800 Message-ID: <20190308053859.19980-1-jerry.lilijun@huawei.com> X-Mailer: git-send-email 2.14.1.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.177.20.134] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH] eal: unmap unneed dpdk VA spaces for legacy mem X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list 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);