[dpdk-dev] [PATCH] eal: decrease the memory init time with many hugepages setup

jerry.lilijun at huawei.com jerry.lilijun at huawei.com
Thu Apr 2 13:30:30 CEST 2015


From: Lilijun <jerry.lilijun at huawei.com>

In the function map_all_hugepages(), hugepage memory is truly allocated by
memset(virtaddr, 0, hugepage_sz). Then it costs about 40s to finish the
dpdk memory initialization when 40000 2M hugepages are setup in host os.
In fact we can only write one byte to finish  the allocation.

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

diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
index 5f9f92e..8bbee9c 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -378,7 +378,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl,
 
 		if (orig) {
 			hugepg_tbl[i].orig_va = virtaddr;
-			memset(virtaddr, 0, hugepage_sz);
+			memset(virtaddr, 0, 1);
 		}
 		else {
 			hugepg_tbl[i].final_va = virtaddr;
-- 
1.9.4.msysgit.1




More information about the dev mailing list