lkml.org 
[lkml]   [2012]   [Jul]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 10/19] mm, mpol: Use special PROT_NONE to migrate pages
    On 07/31/2012 03:12 PM, Peter Zijlstra wrote:

    > + if (unlikely(pmd_trans_splitting(entry))) {
    > + spin_unlock(&mm->page_table_lock);
    > + wait_split_huge_page(vma->anon_vma, pmd);
    > + return;
    > + }
    > +
    > +#ifdef CONFIG_NUMA
    > + page = pmd_page(entry);
    > + VM_BUG_ON(!PageCompound(page) || !PageHead(page));
    > +
    > + get_page(page);
    > + spin_unlock(&mm->page_table_lock);
    > +
    > + /*
    > + * XXX should we serialize against split_huge_page ?
    > + */

    I believe we are already serialized here, because we check
    for pmd_trans_splitting while holding the page table lock.

    The THP code grabs the page table lock when modifying this
    status, so we should be good.

    > + /*
    > + * Due to lacking code to migrate thp pages, we'll split
    > + * (which preserves the special PROT_NONE) and re-take the
    > + * fault on the normal pages.
    > + */
    > + split_huge_page(page);
    > + put_page(page);
    > + return;

    Likewise, the THP code serializes split_huge_page, and has
    protection against multiple simultaneous invocations of
    split_huge_page.

    A second invocation of split_huge_page will see that the
    page was already split, and it will bail out.

    > +do_fixup:
    > + spin_lock(&mm->page_table_lock);
    > + if (unlikely(!pmd_same(*pmd, entry)))
    > + goto out_unlock;

    If the THP was split for another reason than a NUMA
    fault, the !pmd_same check here should result in us
    doing the right thing automatically.

    I believe this code is correct.

    Acked-by: Rik van Riel <riel@redhat.com>

    --
    All rights reversed


    \
     
     \ /
      Last update: 2012-07-31 23:41    [W:0.023 / U:128.508 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site