Skip to contentSkip to conversation

MMU notifiers and hugepage copy-on-write

DISCUSSION Dean Roe 1 participant 1 message Mar 25, 2010 Memory management

lore
Share & tools
lore

Dean Roe

author
#0 lore raw

Are MMU notifiers not handling copy-on-write of hugetlb pages? Looking at the source code, I don't see where this happens. Non-hugetlb pages are handled via:

    do_wp_page() -> set_pte_at_notify() -> mmu_notifier_change_pte()

...but I don't see any MMU notifier callouts down the hugetlb_cow() path, unless it fails to allocate a new_page():

        new_page = alloc_huge_page(vma, address, outside_reserve);

        if (IS_ERR(new_page)) {
                page_cache_release(old_page);

                /*
                 * If a process owning a MAP_PRIVATE mapping fails to COW,
                 * it is due to references held by a child and an insufficient
                 * huge page pool. To guarantee the original mappers
                 * reliability, unmap the page from child processes. The child
                 * may get SIGKILLed if it later faults.
                 */
                if (outside_reserve) {
                        BUG_ON(huge_pte_none(pte));
Quoted 1 line
Quoted 1 line
Quoted 1 line
                 if (unmap_ref_private(mm, vma, old_page, address)) {

..where unmap_ref_private() calls __unmap_hugepage_range() which then calls the MMU notifier invalidate_range functions.

Am I missing something?

Thanks,
Dean

Signature · 9 lines
Dean Roe
Cray Inc.
[email protected]

--
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>