<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Microsoft YaHei";
        panose-1:2 11 5 3 2 2 4 2 2 4;}
@font-face
        {font-family:"\@Microsoft YaHei";
        panose-1:2 11 5 3 2 2 4 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Courier New";
        color:windowtext;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
.MsoChpDefault
        {mso-style-type:export-only;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-IE" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Courier New";mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Courier New";mso-fareast-language:EN-US">I may be incorrect, but is it not simply the case, that when using the no-huge parameter that MAP_HUGETLB is omitted from flags?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Courier New";mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Courier New";mso-fareast-language:EN-US">Ray K<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Courier New";mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-left:36.0pt"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Nick Tian <nick.tian@longsailingsemi.com>
<br>
<b>Sent:</b> Tuesday 9 August 2022 03:55<br>
<b>To:</b> users@dpdk.org<br>
<b>Subject:</b> About memory coherency<o:p></o:p></span></p>
</div>
<p class="MsoNormal" style="margin-left:36.0pt"><o:p> </o:p></p>
<div id="mailbox-conversation">
<div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div id="mailbox-conversation">
<div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei",sans-serif;color:black">Hi<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei",sans-serif;color:black">I am confusing about the "no-huge" option of DPDK 21.11.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei",sans-serif;color:black">The dpdk usage said: --no-huge:Use malloc instead of hugetlbfs.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei",sans-serif;color:black">But when I check the EAL source code, I found some code piece like this:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei",sans-serif;color:black">It's look like "no-huge" option will lead dpdk use memfd_create-->ftruncate-->mmap to reserve memory<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei",sans-serif;color:black">and then provide to application with rte_malloc.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei",sans-serif;color:black">Am I right?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei",sans-serif;color:black">If so, what the "malloc" in "use malloc instead of hugelbfs" refer to?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei",sans-serif;color:black">EAL_memory.c<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei",sans-serif;color:black">static int eal_legacy_hugepage_init(void){<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei",sans-serif;color:black">....<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei",sans-serif;color:black"> if (internal_conf->no_hugetlbfs) {<br>
....<br>
#ifdef MEMFD_SUPPORTED<br>
  /* create a memfd and store it in the segment fd table */<br>
  memfd = memfd_create("nohuge", 0);<br>
......<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei",sans-serif;color:black">  /* we got an fd - now resize it */<br>
   if (ftruncate(memfd, internal_conf->memory) < 0) {<br>
.....<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei",sans-serif;color:black">   fd = memfd;<br>
    flags = MAP_SHARED;   }<br>
....<br>
  prealloc_addr = msl->base_va;<br>
  addr = mmap(prealloc_addr, mem_sz, PROT_READ | PROT_WRITE,<br>
    <span style="background:yellow;mso-highlight:yellow">flags</span> | MAP_FIXED, fd, 0);<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei",sans-serif;color:black">...<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<div>
<div id="mailbox-conversation">
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</body>
</html>