Re: question about COW

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 17 Apr 2010 10:07:26 +0300
Sasha Sirotkin <buildroot@xxxxxxxxxxxxxxx> wrote:

> 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.
> 
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 majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]