• Andrew Morton's avatar
    [PATCH] slab: account for reclaimable caches · 8f542f30
    Andrew Morton authored
    We have a problem at present in vm_enough_memory(): it uses smoke-n-mirrors
    to try to work out how much memory can be reclaimed from dcache and icache.
    it sometimes gets it quite wrong, especially if the slab has internal
    fragmentation.  And it often does.
    
    So here we take a new approach.  Rather than trying to work out how many
    pages are reclaimable by counting up the number of inodes and dentries, we
    change the slab allocator to keep count of how many pages are currently used
    by slabs which can be shrunk by the VM.
    
    The creator of the slab marks the slab as being reclaimable at
    kmem_cache_create()-time.  Slab keeps a global counter of pages which are
    currently in use by thus-tagged slabs.
    
    Of course, we now slightly overestimate the amount of reclaimable memory,
    because not _all_ of the icache, dcache, mbcache and quota caches are
    reclaimable.
    
    But I think it's better to be a bit permissive rather than bogusly failing
    brk() calls as we do at present.
    8f542f30
slab.c 65.1 KB