• Hugh Dickins's avatar
    [PATCH] put shmem metadata in highmem · 2729b9af
    Hugh Dickins authored
    wli suffered OOMs because tmpfs was allocating GFP_USER, for its
    metadata pages.  This patch allocates them GFP_HIGHUSER (default
    mapping->gfp_mask) and uses atomic kmaps to access (KM_USER0 for upper
    levels, KM_USER1 for lowest level).  shmem_unuse_inode and
    shmem_truncate rewritten alike to avoid repeated maps and unmaps of the
    same page: cr's truncate was much more elegant, but I couldn't quite
    see how to convert it.
    
    I do wonder whether this patch is a bloat too far for tmpfs, and even
    non-highmem configs will be penalised by page_address overhead (perhaps
    a further patch could get over that).  There is an attractive
    alternative (keep swp_entry_ts in the existing radix-tree, no metadata
    pages at all), but we haven't worked out an unhacky interface to that.
    For now at least, let's give tmpfs highmem metadata a spin.
    2729b9af
shmem.c 44.8 KB