Skip to content
  • Hugh Dickins's avatar
    tmpfs: preliminary minor tidyups · 75edd345
    Hugh Dickins authored
    
    
    Make a few cleanups in mm/shmem.c, before going on to complicate it.
    
    shmem_alloc_page() will become more complicated: we can't afford to to
    have that complication duplicated between a CONFIG_NUMA version and a
    !CONFIG_NUMA version, so rearrange the #ifdef'ery there to yield a
    single shmem_swapin() and a single shmem_alloc_page().
    
    Yes, it's a shame to inflict the horrid pseudo-vma on non-NUMA
    configurations, but eliminating it is a larger cleanup: I have an
    alloc_pages_mpol() patchset not yet ready - mpol handling is subtle and
    bug-prone, and changed yet again since my last version.
    
    Move __SetPageLocked, __SetPageSwapBacked from shmem_getpage_gfp() to
    shmem_alloc_page(): that SwapBacked flag will be useful in future, to
    help to distinguish different cases appropriately.
    
    And the SGP_DIRTY variant of SGP_CACHE is hard to understand and of
    little use (IIRC it dates back to when shmem_getpage() returned the page
    unlocked): kill it and do the necessary in shmem_file_read_iter().
    
    But an arm64 build then complained that info may be uninitialized (where
    shmem_getpage_gfp() deletes a freshly alloced page beyond eof), and
    advancing to an "sgp <= SGP_CACHE" test jogged it back to reality.
    
    Signed-off-by: default avatarHugh Dickins <hughd@google.com>
    Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Andres Lagar-Cavilla <andreslc@google.com>
    Cc: Yang Shi <yang.shi@linaro.org>
    Cc: Ning Qu <quning@gmail.com>
    Cc: Mel Gorman <mgorman@techsingularity.net>
    Cc: Konstantin Khlebnikov <koct9i@gmail.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    75edd345