Hey, MM developers:)<br><br>I don't know if this posting is proper at here, so sorry for disturbing if it does. <br><br>for normal 4K page: in unmap_page_range <br>1: tlb_start_vma(tlb, vma); &lt;------ call&nbsp; flush_cache_range to invalidate icache if vma is VM_EXEC<br>2: clear pagetable mapping<br>3: tlb_end_vma(tlb, vma); &lt;-------- call flush_tlb_range to invalidate unmapped vma tlb entry<br><br>for hugepage: in __unmap_hugepage_range<br>1: clear pagetable mapping<br> 2: call flush_tlb_range(vma, start, end); to invalidate unmapped vma tlb entry<br><br>I really don't understand about two things:<br>A: why there is no  flush_cache_range for hugepage when we do the unmapping?<br>B: How does kernel take care of such case for both normal 4K page and hugepage:<br>&nbsp;&nbsp;&nbsp; a: mmap a page with PROT_EXEC at location p;<br>&nbsp;&nbsp;&nbsp; b: copy bunch instruction into p ,call cacheflush to make ICACHE see the new instruction; <br>&nbsp;&nbsp;&nbsp; c: run instruction at location p, then unmap it;<br>&nbsp;&nbsp;&nbsp; d: mmap a new page with MAP_FIXED/PROT_EXEC at location p, and run unexpected instruction at p;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; there is a great chance we got the same page at step_a;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; user space should see a clean icache, not a stale one;<br>&nbsp;&nbsp;&nbsp;&nbsp; <br>I am really puzzled for a long time.<br>I am porting hugepage for ARM ,and one testcase in libhugetlbfs called icache-hygiene failed, test rationale is described&nbsp; in above B.<br><br>Any tips/advice would be truly appreciated.<br>Thanks<br><br>&nbsp;<br><br><br><br><br><br>        
<br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>