linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* question about COW
@ 2010-04-17  7:07 Sasha Sirotkin
  2010-04-19  3:47 ` KAMEZAWA Hiroyuki
  0 siblings, 1 reply; 2+ messages in thread
From: Sasha Sirotkin @ 2010-04-17  7:07 UTC (permalink / raw)
  To: linux-mm

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: question about COW
  2010-04-17  7:07 question about COW Sasha Sirotkin
@ 2010-04-19  3:47 ` KAMEZAWA Hiroyuki
  0 siblings, 0 replies; 2+ messages in thread
From: KAMEZAWA Hiroyuki @ 2010-04-19  3:47 UTC (permalink / raw)
  To: Sasha Sirotkin; +Cc: linux-mm

On Sat, 17 Apr 2010 10:07:26 +0300
Sasha Sirotkin <buildroot@browserseal.com> 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@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-04-19  3:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-17  7:07 question about COW Sasha Sirotkin
2010-04-19  3:47 ` KAMEZAWA Hiroyuki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox