lkml.org 
[lkml]   [2014]   [Feb]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectHow pte_mkspecial makes zero-page COW on x86 ARCH
From
Hi All,
I read the code in do_anonymous_page of the latest linux kernel.
I am pretty confused how pte_mkspecial to make the zero-page COW on
x86 architecture
<code>
static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma,
unsigned long address, pte_t *page_table, pmd_t *pmd,
unsigned int flags)
{
.....
/* Use the zero-page for reads */
if (!(flags & FAULT_FLAG_WRITE)) {
entry = pte_mkspecial(pfn_pte(my_zero_pfn(address),
vma->vm_page_prot));
page_table = pte_offset_map_lock(mm, pmd, address, &ptl);
if (!pte_none(*page_table))
goto unlock;
goto setpte;
}
......
}
</code>
In the previous linux kernel, this is done by pte_wrprotect to make page COW.
Thanks for your time!

Best Wishes,
Yaohui


\
 
 \ /
  Last update: 2014-02-19 17:21    [W:0.040 / U:0.824 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site