• Shakeel Butt's avatar
    mm: fadvise: avoid fadvise for fs without backing device · 3a77d214
    Shakeel Butt authored
    The fadvise() manpage is silent on fadvise()'s effect on memory-based
    filesystems (shmem, hugetlbfs & ramfs) and pseudo file systems (procfs,
    sysfs, kernfs).  The current implementaion of fadvise is mostly a noop
    for such filesystems except for FADV_DONTNEED which will trigger
    expensive remote LRU cache draining.  This patch makes the noop of
    fadvise() on such file systems very explicit.
    
    However this change has two side effects for ramfs and one for tmpfs.
    First fadvise(FADV_DONTNEED) could remove the unmapped clean zero'ed
    pages of ramfs (allocated through read, readahead & read fault) and
    tmpfs (allocated through read fault).  Also fadvise(FADV_WILLNEED) could
    create such clean zero'ed pages for ramfs.  This change removes those
    possibilities.
    
    One of our generic libraries does fadvise(FADV_DONTNEED).  Recently we
    observed high latency in fadvise() and noticed that the users have
    started using tmpfs files and the latency was due to expensive remote
    LRU cache draining.  For normal tmpfs files (have data written on them),
    fadvise(FADV_DONTNEED) will always trigger the unneeded remote cache
    draining.
    
    Link: http://lkml.kernel.org/r/20170818011023.181465-1-shakeelb@google.comSigned-off-by: 's avatarShakeel Butt <shakeelb@google.com>
    Cc: Mel Gorman <mgorman@suse.de>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Hillf Danton <hillf.zj@alibaba-inc.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Greg Thelen <gthelen@google.com>
    Signed-off-by: 's avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: 's avatarLinus Torvalds <torvalds@linux-foundation.org>
    3a77d214
Name
Last commit
Last update
Documentation Loading commit data...
arch Loading commit data...
block Loading commit data...
certs Loading commit data...
crypto Loading commit data...
drivers Loading commit data...
firmware Loading commit data...
fs Loading commit data...
include Loading commit data...
init Loading commit data...
ipc Loading commit data...
kernel Loading commit data...
lib Loading commit data...
mm Loading commit data...
net Loading commit data...
samples Loading commit data...
scripts Loading commit data...
security Loading commit data...
sound Loading commit data...
tools Loading commit data...
usr Loading commit data...
virt Loading commit data...
.cocciconfig Loading commit data...
.get_maintainer.ignore Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
Kbuild Loading commit data...
Kconfig Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README Loading commit data...