• Andrew Morton's avatar
    [PATCH] Fix arithmetic in shrink_zone() · 6fa1d901
    Andrew Morton authored
    From: Nick Piggin <nickpiggin@yahoo.com.au>
    
    If the zone has a very small number of inactive pages, local variable
    `ratio' can be huge and we do way too much scanning.  So much so that Ingo
    hit an NMI watchdog expiry, although that was because the zone would have a
    had a single refcount-zero page in it, and that logic recently got fixed up
    via get_page_testone().
    
    Nick's patch simply puts a sane-looking upper bound on the number of pages
    which we'll scan in this round.
    
    
    It fixes another failure case: if the inactive list becomes very small
    compared to the size of the active list, active list scanning (and therefore
    inactive list refilling) also becomes small.
    
    This patch causes inactive list scanning to be keyed off the size of the
    active+inactive lists.  It has the plus of hiding active and inactive
    balancing implementation from the higher level scanning code.  It will
    slightly change other aspects of scanning behaviour, but probably not
    significantly.
    6fa1d901
vmscan.c 32.5 KB