Skip to content
  • Yafang Shao's avatar
    mm, fadvise: improve the expensive remote LRU cache draining after FADV_DONTNEED · eb1d7a65
    Yafang Shao authored
    Our users reported that there're some random latency spikes when their RT
    process is running.  Finally we found that latency spike is caused by
    FADV_DONTNEED.  Which may call lru_add_drain_all() to drain LRU cache on
    remote CPUs, and then waits the per-cpu work to complete.  The wait time
    is uncertain, which may be tens millisecond.
    
    That behavior is unreasonable, because this process is bound to a specific
    CPU and the file is only accessed by itself, IOW, there should be no
    pagecache pages on a per-cpu pagevec of a remote CPU.  That unreasonable
    behavior is partially caused by the wrong comparation of the number of
    invalidated pages and the number of the target.  For example,
    
            if (count < (end_index - start_index + 1))
    
    The count above is how many pages were invalidated in the local CPU, and
    (end_index - start_index + 1) is how many pages should be invalidated.
    The usage of (end_index - start_index + 1) is incorrect,...
    eb1d7a65