DPDK patches and discussions
 help / color / mirror / Atom feed
From: Lilijun <jerry.lilijun@huawei.com>
To: <dev@dpdk.org>
Cc: <jerry.zhang@intel.com>, <ian.stokes@intel.com>,
	Lilijun <jerry.lilijun@huawei.com>
Subject: [dpdk-dev] [PATCH] eal: unmap unneed dpdk VA spaces for legacy mem
Date: Fri, 8 Mar 2019 13:38:59 +0800	[thread overview]
Message-ID: <20190308053859.19980-1-jerry.lilijun@huawei.com> (raw)

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@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

             reply	other threads:[~2019-03-08  5:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-08  5:38 Lilijun [this message]
2019-03-08  9:37 ` Burakov, Anatoly
2019-03-12  1:47   ` Lilijun (Jerry, Cloud Networking)
2019-03-12 11:02     ` Burakov, Anatoly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190308053859.19980-1-jerry.lilijun@huawei.com \
    --to=jerry.lilijun@huawei.com \
    --cc=dev@dpdk.org \
    --cc=ian.stokes@intel.com \
    --cc=jerry.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).