<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" 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=Windows-1252">
<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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:2002659302;
mso-list-type:hybrid;
mso-list-template-ids:-1294817576 238610790 134807577 134807579 134807567 134807577 134807579 134807567 134807577 134807579;}
@list l0:level1
{mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:55.5pt;
text-indent:-18.0pt;}
@list l0:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:91.5pt;
text-indent:-18.0pt;}
@list l0:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
margin-left:127.5pt;
text-indent:-9.0pt;}
@list l0:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:163.5pt;
text-indent:-18.0pt;}
@list l0:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:199.5pt;
text-indent:-18.0pt;}
@list l0:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
margin-left:235.5pt;
text-indent:-9.0pt;}
@list l0:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:271.5pt;
text-indent:-18.0pt;}
@list l0:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:307.5pt;
text-indent:-18.0pt;}
@list l0:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
margin-left:343.5pt;
text-indent:-9.0pt;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style>
</head>
<body lang="EN-IN" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Thanks Dmitry for quick turn around
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Yes below are my answers<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><br>
There still DPDK malloc internal structures that you cannot adjust.<br>
I suggest going another way:<br>
Instead of letting DPDK allocate all hugepages and unmapping some,<br>
allow DPDK to allocate an absolute minimum (1 x 2MB page?)<br>
and add all the rest you need via rte_extmem_*() API.<br>
<br>
<o:p></o:p></p>
<p class="MsoNormal">[Uma] : Yes I agree if free_hp = 400, nr_hp = 252, we are expecting DPDK takes only 252 and keep the remaining pages free in its heap.
<o:p></o:p></p>
<p class="MsoNormal"> As you have mentioned just boot DPDK with 1 page, and add pages we want later, is this the steps<o:p></o:p></p>
<ol style="margin-top:0cm" start="1" type="1">
<li class="MsoListParagraph" style="margin-left:19.5pt;mso-list:l0 level1 lfo1">NR_HP =1 , FREE_HP = 1<o:p></o:p></li><li class="MsoListParagraph" style="margin-left:19.5pt;mso-list:l0 level1 lfo1">EAL INIT (DPDK boots up with 1 2 MB page)<o:p></o:p></li><li class="MsoListParagraph" style="margin-left:19.5pt;mso-list:l0 level1 lfo1">What is the API for adding later on pages ? (rte_extmem_*, can you please give the full API details and how to call it with arguments )<o:p></o:p></li></ol>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">We can do 1,2,3 there is a problem once we reduce pages to 1 , kernel will free the huge pages totally
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">So is there a way not to touch NR_HP, FREE_HP, and just pass arguments to boot DPDK with just 1 page ? Please let us know and later add pages we need to DPDK !!<o:p></o:p></p>
<p class="MsoNormal"><br>
Why do you need legacy mode in the first place?<br>
Looks like you're painfully trying to achieve the same result<br>
that dynamic mode would give you automatically.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">[Uma] : Yes , we can’t avoid legacy memory design as secondary process mapped page by page to primary process , and physical addr space is same for both processes. We have to stick to legacy memory design only for now !!<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks<o:p></o:p></p>
<p class="MsoNormal">Umakiran<span style="mso-fareast-language:EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">Dmitry Kozlyuk <dmitry.kozliuk@gmail.com><br>
<b>Date: </b>Friday, 23 September 2022 at 5:17 PM<br>
<b>To: </b>Umakiran Godavarthi (ugodavar) <ugodavar@cisco.com><br>
<b>Cc: </b>anatoly.burakov@intel.com <anatoly.burakov@intel.com>, dev@dpdk.org <dev@dpdk.org>, stephen@networkplumber.org <stephen@networkplumber.org><br>
<b>Subject: </b>Re: DPDK 19.11.5 Legacy Memory Design Query<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal">2022-09-23 11:20 (UTC+0000), Umakiran Godavarthi (ugodavar):
<br>
> [Uma] : Yes we are unmapping the entire range hoping all are free inside DPDK and DPDK heaps never use these pages.<br>
> <br>
> Suppose we have 400 pages total free_hp, we want only 252 pages , so we reduce nr_pages to 252.<br>
> <br>
> So we assume 253 to 400 inside DPDK are free as we nr_pages are made by my application as 252.<br>
> <br>
> ms_idx = rte_fbarray_find_next_n_free(arr, 0, 2); -> 253 comes<br>
> ms_check_idx = rte_fbarray_find_next_n_free(arr, 0, RTE_PTR_DIFF(RTE_PTR_ADD(msl->base_va, msl->len), addr)/msl->page_sz); -> 253 comes (should be same as above)<br>
> ms_next_idx = rte_fbarray_find_next_used(arr, ms_idx); -> This comes -1 as NO USED page is there (<0)<br>
> <br>
> Hence we call unmap like -> munmap(addr, RTE_PTR_DIFF(RTE_PTR_ADD(msl->base_va, msl->len), addr));<br>
> <br>
> Please let us know how to check in DPDK free heaps or FBARRAY that these pages we are freeing are really safe ? (253 to 400 unwanted pages by our application, other than above 3 checks)<br>
> <br>
> If it’s not safe to free, how to inform DPDK to free those pages in FBARRAY and also clean up its heap list so that it never crashes !!<br>
<br>
There still DPDK malloc internal structures that you cannot adjust.<br>
I suggest going another way:<br>
Instead of letting DPDK allocate all hugepages and unmapping some,<br>
allow DPDK to allocate an absolute minimum (1 x 2MB page?)<br>
and add all the rest you need via rte_extmem_*() API.<br>
<br>
Why do you need legacy mode in the first place?<br>
Looks like you're painfully trying to achieve the same result<br>
that dynamic mode would give you automatically.<o:p></o:p></p>
</div>
</div>
</body>
</html>