• Andrew Morton's avatar
    [PATCH] move_one_page atomicity fix · d8f299c2
    Andrew Morton authored
    The atomicicty fix for move_one_page() was not quite right.
    
    We only do the page_table_present() test if CONFIG_HIGHPTE=y.  Which is
    fine, but even with CONFIG_HIGHPTE=n, the pte mapping functions still
    do an inc_preempt_count() due to their unconditional kmap_atomic().  So
    we get a might_sleep() warning.
    
    The warning is actually bogus, because those pte's are always in
    direct-mapped memory.
    
    So hm.  Three fixes suggest themselves:
    
    1: Run the page_table_present() test if CONFIG_HIGHMEM.
    
       Rejected: penalises non-pte_highmem setups
    
    2: Make kmap_atomic() not do inc_preempt_count() is the page was
       direct mapped.
    
       Rejected: I don't think we want kmap_atomic side effects to be
       varying according to the page which was passed.
    
    3: Change the pte mapping functions so they don't run kmap_atomic at
       all if CONFIG_HIGHPTE=n
    
       This is what I did.  And guess what?  For CONFIG_HIGHMEM=y,
       CONFIG_HIGHPTE=n this patch shrinks the kernel by 5 kbytes.  Because
       kmap_atomic is inlined.
    
       The lesson: we do way too much damn inlining.
    d8f299c2
pgtable.h 10.5 KB