linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* mm/ksm.c seems to be doing an unneeded _notify.
@ 2010-03-10 19:18 Robin Holt
  2010-03-10 20:19 ` Chris Wright
  2010-03-10 20:19 ` Izik Eidus
  0 siblings, 2 replies; 9+ messages in thread
From: Robin Holt @ 2010-03-10 19:18 UTC (permalink / raw)
  To: Izik Eidus; +Cc: Hugh Dickins, Chris Wright, linux-mm

While reviewing ksm.c, I noticed that ksm.c does:

        if (pte_write(*ptep)) {
                pte_t entry;

                swapped = PageSwapCache(page);
                flush_cache_page(vma, addr, page_to_pfn(page));
                /*
                 * Ok this is tricky, when get_user_pages_fast() run it doesnt
                 * take any lock, therefore the check that we are going to make
                 * with the pagecount against the mapcount is racey and
                 * O_DIRECT can happen right after the check.
                 * So we clear the pte and flush the tlb before the check
                 * this assure us that no O_DIRECT can happen after the check
                 * or in the middle of the check.
                 */
                entry = ptep_clear_flush(vma, addr, ptep);
                /*
                 * Check that no O_DIRECT or similar I/O is in progress on the
                 * page 
                 */
                if (page_mapcount(page) + 1 + swapped != page_count(page)) {
                        set_pte_at_notify(mm, addr, ptep, entry);
                        goto out_unlock;
                }
                entry = pte_wrprotect(entry);
                set_pte_at_notify(mm, addr, ptep, entry);


I would think the error case (where the page has an elevated page_count)
should not be using set_pte_at_notify.  In that event, you are simply
restoring the previous value.  Have I missed something or is this an
extraneous _notify?

Thanks,
Robin Holt

--
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] 9+ messages in thread

end of thread, other threads:[~2010-03-11 16:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-10 19:18 mm/ksm.c seems to be doing an unneeded _notify Robin Holt
2010-03-10 20:19 ` Chris Wright
2010-03-10 20:19 ` Izik Eidus
2010-03-10 22:19   ` Andrea Arcangeli
2010-03-11  6:23     ` Hugh Dickins
2010-03-11 13:20       ` Izik Eidus
2010-03-11 15:54         ` [Patch] mm/ksm.c is doing an unneeded _notify in write_protect_page Robin Holt
2010-03-11 16:01           ` Izik Eidus
2010-03-11 16:06             ` Andrea Arcangeli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).