• Andrew Morton's avatar
    [PATCH] make pagemap_lru_lock irq-safe · aaba9265
    Andrew Morton authored
    It is expensive for a CPU to take an interrupt while holding the page
    LRU lock, because other CPUs will pile up on the lock while the
    interrupt runs.
    
    Disabling interrupts while holding the lock reduces contention by an
    additional 30% on 4-way.  This is when the only source of interrupts is
    disk completion.  The improvement will be higher with more CPUs and it
    will be higher if there is networking happening.
    
    The maximum hold time of this lock is 17 microseconds on 500 MHx PIII,
    which is well inside the kernel's maximum interrupt latency (which was
    100 usecs when I last looked, a year ago).
    
    This optimisation is not needed on uniprocessor, but the patch disables
    IRQs while holding pagemap_lru_lock anyway, so it becomes an irq-safe
    spinlock, and pages can be moved from the LRU in interrupt context.
    
    pagemap_lru_lock has been renamed to _pagemap_lru_lock to pick up any
    missed uses, and to reliably break any out-of-tree patches which may be
    using the old semantics.
    aaba9265
vmscan.c 17.6 KB