patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Gowrishankar <gowrishankar.m@linux.vnet.ibm.com>
To: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>,
	Bruce Richardson <bruce.richardson@intel.com>,
	Konstantin Ananyev <konstantin.ananyev@intel.com>
Cc: stable@dpdk.org, Chao Zhu <chaozhu@linux.vnet.ibm.com>,
	Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
Subject: [dpdk-stable] [PATCH 2/3] eal: reorder calling munmap on zero-mapped memory
Date: Thu, 21 Jun 2018 10:57:37 +0530	[thread overview]
Message-ID: <c4c969943fa398228581ab4529154d41f7a08d43.1527076172.git.gowrishankar.m@linux.vnet.ibm.com> (raw)
In-Reply-To: <cover.1527076172.git.gowrishankar.m@linux.vnet.ibm.com>
In-Reply-To: <cover.1527076172.git.gowrishankar.m@linux.vnet.ibm.com>

From: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>

In the current code path where secondary processes attaches memory
mapped area that primary process created, it releases one by one
zero-mapped memory in VA for the length of every iterated rte_memseg.
PowerPC mm would not be able to respect address hint as secondary
process would later ask to mmap hugepages in this freed area.
For powerpc mm to respect address hint, its entire underlying memory
slice (of about 1 TB in VA) should have been freed before re-mapping
requested. So, we move this munmap() slightly above, from its current
calling place so that, entire zero mapped area is alredy freed.

Fixes: 284ae3e9ff ("eal/ppc: fix mmap for memory initialization")
Cc: stable@dpdk.org

Signed-off-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
---
 lib/librte_eal/linuxapp/eal/eal_memory.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
index 2dcb3b5..3dcd6c2 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -1428,6 +1428,11 @@ void numa_error(char *where)
 			}
 			goto error;
 		}
+		/*
+		 * free previously mapped memory so we can map the
+		 * hugepages into this space shortly
+		 */
+		munmap(base_addr, mcfg->memseg[s].len);
 	}
 
 	size = getFileSize(fd_hugepage);
@@ -1445,12 +1450,7 @@ void numa_error(char *where)
 		void *addr, *base_addr;
 		uintptr_t offset = 0;
 		size_t mapping_size;
-		/*
-		 * free previously mapped memory so we can map the
-		 * hugepages into the space
-		 */
 		base_addr = mcfg->memseg[s].addr;
-		munmap(base_addr, mcfg->memseg[s].len);
 
 		/* find the hugepages for this segment and map them
 		 * we don't need to worry about order, as the server sorted the
-- 
1.9.1

  parent reply	other threads:[~2018-06-21  5:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-23 12:53 [dpdk-stable] [PATCH 0/3] eal: clean up mapping hugepages in secondary process for ppc64le Gowrishankar
2018-06-21  5:27 ` Gowrishankar
2018-06-21  5:27 ` [dpdk-stable] [PATCH 1/3] eal: access hugepage_file in reverse order for powerpc Gowrishankar
2018-06-21  5:27 ` Gowrishankar [this message]
2018-06-21  5:27 ` [dpdk-stable] [PATCH 3/3] eal: reverse powerpc changes done for hugepage overcommit Gowrishankar
2018-06-21  8:50 ` [dpdk-stable] [PATCH 0/3] eal: clean up mapping hugepages in secondary process for ppc64le Luca Boccassi
2018-06-21  8:54   ` gowrishankar muthukrishnan

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=c4c969943fa398228581ab4529154d41f7a08d43.1527076172.git.gowrishankar.m@linux.vnet.ibm.com \
    --to=gowrishankar.m@linux.vnet.ibm.com \
    --cc=bruce.richardson@intel.com \
    --cc=chaozhu@linux.vnet.ibm.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=sergio.gonzalez.monroy@intel.com \
    --cc=stable@dpdk.org \
    /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).