• Nick Piggin's avatar
    [PATCH] make shrinker_sem an rwsem · 47ad9591
    Nick Piggin authored
    Use an rwsem to protect the shrinker list instead of a regular
    semaphore.  Modifications to the list are now done under the write lock,
    shrink_slab takes the read lock, and access to shrinker->nr becomes racy
    (which is no different to how the page lru scanner is implemented).  The
    shrinker functions become concurrent.
    
    Previously, having the slab scanner get preempted or scheduling while
    holding the semaphore would cause other tasks to skip putting pressure on
    the slab.
    
    Also, make shrink_icache_memory return -1 if it can't do anything in order
    to hold pressure on this cache and prevent useless looping in shrink_slab.
    Signed-off-by: default avatarNick Piggin <nickpiggin@yahoo.com.au>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    47ad9591
inode.c 35.6 KB