• Hugh Dickins's avatar
    [PATCH] shmem: inodes and links need lowmem · 77cdadab
    Hugh Dickins authored
    Keith Mannthey's Bugzilla #3268 drew attention to how tmpfs inodes and
    dentries and long names and radix-tree nodes pin lowmem.  Assuming about 1k of
    lowmem per inode, we need to lower the default nr_inodes limit on machines
    with significant highmem.
    
    Be conservative, but more generous than in the original patch to Keith: limit
    to number of lowmem pages, which works out around 200,000 on i386.  Easily
    overridden by giving the nr_inodes= mount option: those who want to sail
    closer to the rocks should be allowed to do so.
    
    Notice how tmpfs dentries cannot be reclaimed in the way that disk-based
    dentries can: so even hard links need to be costed.  They are cheaper than
    inodes, but easier all round to charge the same.  This way, the limit for hard
    links is equally visible through "df -i": but expect occasional bugreports
    that tmpfs links are being treated like this.
    
    Would have been simpler just to move the free_inodes accounting from
    shmem_delete_inode to shmem_unlink; but that would lose the charge on unlinked
    but open files.
    Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    77cdadab
shmem.c 52.7 KB