<br>At&nbsp;2011-03-02&nbsp;23:52:03£¬"Rabin&nbsp;Vincent"&nbsp;&lt;rabin@rab.in&gt;&nbsp;wrote:&gt;On&nbsp;Fri,&nbsp;Feb&nbsp;25,&nbsp;2011&nbsp;at&nbsp;09:05,&nbsp;rocky&nbsp;&lt;bill_carson@126.com&gt;&nbsp;wrote:&gt;&gt;&nbsp;free_pgd_slow&nbsp;in&nbsp;arch/arm/mm/pgd.c&nbsp;&nbsp;free&nbsp;the&nbsp;4&nbsp;pages&nbsp;at&nbsp;pgd&nbsp;level,l&gt;&gt;&nbsp;while&nbsp;could&nbsp;I&nbsp;ask&nbsp;a&nbsp;question&nbsp;about&nbsp;why&nbsp;free&nbsp;the&nbsp;page&nbsp;by&nbsp;pointed&nbsp;by&nbsp;pgd&gt;&gt;&nbsp;index&nbsp;0&nbsp;?&gt;&gt;Besides&nbsp;the&nbsp;16k&nbsp;for&nbsp;the&nbsp;pgd,&nbsp;it&nbsp;frees&nbsp;the&nbsp;second&nbsp;level*&nbsp;page&nbsp;table&gt;referenced&nbsp;at&nbsp;index&nbsp;0&nbsp;of&nbsp;the&nbsp;pgd.&gt;&gt;(*&nbsp;-&nbsp;of&nbsp;course&nbsp;it&nbsp;frees&nbsp;pud+pmd+pte,&nbsp;but&nbsp;on&nbsp;current&nbsp;ARM&nbsp;this&nbsp;folds&nbsp;down&gt;to&nbsp;just&nbsp;the&nbsp;second&nbsp;level&nbsp;page&nbsp;table.)&gt;&gt;On&nbsp;ARM,&nbsp;FIRST_USER_ADDRESS&nbsp;is&nbsp;set&nbsp;to&nbsp;PAGE_SIZE&nbsp;because&nbsp;the&nbsp;vectors&nbsp;may&gt;need&nbsp;to&nbsp;be&nbsp;placed&nbsp;at&nbsp;0x0.&nbsp;&nbsp;Since&nbsp;the&nbsp;tables&nbsp;for&nbsp;that&nbsp;translation&nbsp;have&nbsp;to&gt;always&nbsp;be&nbsp;active,&nbsp;functions&nbsp;like&nbsp;exit_mmap()&nbsp;will&nbsp;not&nbsp;free&nbsp;the&nbsp;0th&gt;secondary&nbsp;level&nbsp;page&nbsp;table&nbsp;(see&nbsp;the&nbsp;calls&nbsp;to&nbsp;free_pgtables()&nbsp;there).&nbsp;&nbsp;So&gt;we&nbsp;free&nbsp;it&nbsp;here&nbsp;when&nbsp;we're&nbsp;freeing&nbsp;the&nbsp;pgd.<br>Thanks&nbsp;Rabin<br>I&nbsp;dig&nbsp;the&nbsp;code&nbsp;more&nbsp;deeper,<br>exit_mmap&nbsp;called&nbsp;free_pgtables&nbsp;by&nbsp;setting&nbsp;floor&nbsp;with&nbsp;FIRST_USER_ADDRESS,&nbsp;<br>then&nbsp;in&nbsp;free_pgd_range&nbsp;,&nbsp;vma-&gt;start&nbsp;first&nbsp;aligned&nbsp;with&nbsp;PMD_MASK&nbsp;before&nbsp;compared&nbsp;with&nbsp;floor,&nbsp;<br>PMD_MASK&nbsp;for&nbsp;arm&nbsp;is&nbsp;2M&nbsp;aligned&nbsp;,so&nbsp;that&nbsp;means&nbsp;0~0x200000&nbsp;virtual&nbsp;address&nbsp;mapping&nbsp;is&nbsp;free&nbsp;in<br>free_pgd_slow.<br><br>But&nbsp;I&nbsp;still&nbsp;dont&nbsp;get&nbsp;it,&nbsp;<br>why&nbsp;is&nbsp;that&nbsp;&nbsp;low&nbsp;vector&nbsp;mapping&nbsp;must&nbsp;always&nbsp;be&nbsp;active&nbsp;even&nbsp;though&nbsp;the&nbsp;task&nbsp;is&nbsp;going&nbsp;to&nbsp;exit?<br><br>rocky<br><br><br><br><br><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>