• Andrew Morton's avatar
    [PATCH] Fix interaction between batched lru addition and hot/cold · 3c7b8b3c
    Andrew Morton authored
    If a page is "freed" while in the deferred-lru-addition queue, the
    final reference to it is the deferred lru addition queue.  When that
    queue gets spilled onto the LRU, the page is actually freed.
    
    Which is all expected and natural and works fine - it's a weird case.
    
    But one of the AIM9 tests was taking a 20% performance hit (relative to
    2.4) because it was going into the page allocator for new pages while
    cache-hot pages were languishiung out in the deferred-addition queue.
    
    So the patch changes things so that we spill the CPU's
    deferred-lru-addition queue before starting to free pages.  This way,
    the recently-used pages actually make it to the hot/cold lists and are
    available for new allocations.
    
    It gets back 15 of the lost 20%.  The other 5% is lost to the general
    additional complexity of all this stuff.  (But we're 250% faster than
    2.4 when running four instances of the test on 4-way).
    3c7b8b3c
swap_state.c 9.89 KB