• Andrew Morton's avatar
    [PATCH] rmap 14: i_shared_lock fixes · d3f42511
    Andrew Morton authored
    From: Hugh Dickins <hugh@veritas.com>
    
    First of batch of six patches which introduce Rajesh Venkatasubramanian's
    implementation of a radix priority search tree of vmas, to handle object-based
    reverse mapping corner cases well.
    
    rmap 14 i_shared_lock fixes
    
    Start the sequence with a couple of outstanding i_shared_lock fixes.
    
    Since i_shared_sem became i_shared_lock, we've had to shift and then
    temporarily remove mremap move's protection of concurrent truncation - if
    mremap moves ptes while unmap_mapping_range_list is making its way through the
    vmas, there's a danger we'd move a pte from an area yet to be cleaned back
    into an area already cleared.
    
    Now site the i_shared_lock with the page_table_lock in move_one_page.  Replace
    page_table_present by get_one_pte_map, so we know when it's necessary to
    allocate a new page table: in which case have to drop i_shared_lock, trylock
    and perhaps reorder locks on the way back.  Yet another fix: must check for
    NULL dst before pte_unmap(dst).
    
    And over in rmap.c, try_to_unmap_file's cond_resched amidst its lengthy
    nonlinear swapping was now causing might_sleep warnings: moved to a rather
    unsatisfactory and less frequent cond_resched_lock on i_shared_lock when we
    reach the end of the list; and one before starting on the nonlinears too: the
    "cursor" may become out-of-date if we do schedule, but I doubt it's worth
    bothering about.
    d3f42511
mremap.c 10.9 KB