• Andrew Morton's avatar
    [PATCH] realtime swapspace accounting · fbe7559b
    Andrew Morton authored
    There are a couple of statistical functions which scan the entire swap
    map counting things up, to display in /proc.
    
    On my machine, these hold spinlocks for 19 milliseconds which is
    unacceptable from a scheduling latency point of view.
    
    And an application which sits in a loop reading /proc/swaps on a large
    machine is probably a decent denial-of-service attack - it will limit
    swap allocations to tens of pages per second.
    
    So add a counter to swap_info_struct and use it to track how many pages
    are currently in use, so those reporting functions don't need to add
    them all up.
    fbe7559b
swapfile.c 37.2 KB