question about COW
There is an "early COW" mechanism in __do_fault() which, if the page is not present and the fault is FAULT_PAGE_WRITE goes ahead and copies the page in order to prevent the next exception.
The question - why the code in __do_fault() does not decrease the shared map count of the old page as do_wp_page does ? And while we are at it, while this "early COW" code is much more simple than do_wp_page()?
Thanks.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 10 lines · On Sat, 17 Apr 2010 10:07:26 +0300 Sasha Sirotkin <[email protected]>…
There is an "early COW" mechanism in
__do_fault()which, if the page is not present and the fault isFAULT_PAGE_WRITEgoes ahead and copies the page in order to prevent the next exception.The question - why the code in
__do_fault()does not decrease the shared map count of the old page asdo_wp_pagedoes ? And while we are at it, while this "early COW" code is much more simple thando_wp_page()?Thanks.
IIUC.
Case 1) A task cause a write page fault because pte is not set as PRESENT.
__do_fault() is called. And the kernel found vma is not-SHARED.
Do eary-COW. In this case, the old page was not _mapped_...IOW, the task's this pte was not accounted into old_page->mapcount.
We just increase new_page->mapcount. Don't touch old_page->mapcount.
Case 2) A task caused a write page fault because pte was not WRITABLE.
do_wp_page() is called because the page was _mapped_.
If the page is shared, decrease old_page->mapcount, increae new_page->mapcount.
Regard,
-Kame
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>