[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAHqbYQtLG0yE98kCHkCaec+oHF7c2Pwiqrsi5C2eHnGfbsR+sQ@mail.gmail.com>
Date: Wed, 19 Feb 2014 10:28:40 -0500
From: Hu Yaohui <loki2441@...il.com>
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: How pte_mkspecial makes zero-page COW on x86 ARCH
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists