• Yu Zhao's avatar
    mm: support POSIX_FADV_NOREUSE · 17e81022
    Yu Zhao authored
    This patch adds POSIX_FADV_NOREUSE to vma_has_recency() so that the LRU
    algorithm can ignore access to mapped files marked by this flag.
    
    The advantages of POSIX_FADV_NOREUSE are:
    1. Unlike MADV_SEQUENTIAL and MADV_RANDOM, it does not alter the
       default readahead behavior.
    2. Unlike MADV_SEQUENTIAL and MADV_RANDOM, it does not split VMAs and
       therefore does not take mmap_lock.
    3. Unlike MADV_COLD, setting it has a negligible cost, regardless of
       how many pages it affects.
    
    Its limitations are:
    1. Like POSIX_FADV_RANDOM and POSIX_FADV_SEQUENTIAL, it currently does
       not support range. IOW, its scope is the entire file.
    2. It currently does not ignore access through file descriptors.
       Specifically, for the active/inactive LRU, given a file page shared
       by two users and one of them having set POSIX_FADV_NOREUSE on the
       file, this page will be activated upon the second user accessing
       it. This corner case can be covered by checking POSIX_FADV_NOREUSE
       before cal...
    17e81022
fadvise.c 5.63 KB