X-Git-Url: https://git.kernelconcepts.de/?a=blobdiff_plain;f=mm%2Ffadvise.c;h=a430131125815803ba25a7014917c6118087dd5c;hb=4dd72b4a47a5309333c8ddf9ec7df3380dede30d;hp=6c707bfe02fde002feae9ea2fab3fc9647c3baa0;hpb=3ef500a53f8c44ca82decf79dd8138fd07c7739d;p=karo-tx-linux.git diff --git a/mm/fadvise.c b/mm/fadvise.c index 6c707bfe02fd..a43013112581 100644 --- a/mm/fadvise.c +++ b/mm/fadvise.c @@ -139,7 +139,20 @@ SYSCALL_DEFINE4(fadvise64_64, int, fd, loff_t, offset, loff_t, len, int, advice) } if (end_index >= start_index) { - unsigned long count = invalidate_mapping_pages(mapping, + unsigned long count; + + /* + * It's common to FADV_DONTNEED right after + * the read or write that instantiates the + * pages, in which case there will be some + * sitting on the local LRU cache. Try to + * avoid the expensive remote drain and the + * second cache tree walk below by flushing + * them out right away. + */ + lru_add_drain(); + + count = invalidate_mapping_pages(mapping, start_index, end_index); /*