From: Shawn Bohrer Date: Tue, 10 Jan 2012 23:07:35 +0000 (-0800) Subject: fadvise: only initiate writeback for specified range with FADV_DONTNEED X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ad8a1b558e6c76fb53901956d3c8f29b82a4ccfa;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git fadvise: only initiate writeback for specified range with FADV_DONTNEED Previously POSIX_FADV_DONTNEED would start writeback for the entire file when the bdi was not write congested. This negatively impacts performance if the file contains dirty pages outside of the requested range. This change uses __filemap_fdatawrite_range() to only initiate writeback for the requested range. Signed-off-by: Shawn Bohrer Acked-by: Johannes Weiner Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/fadvise.c b/mm/fadvise.c index 8d723c9e8b75..469491e0af79 100644 --- a/mm/fadvise.c +++ b/mm/fadvise.c @@ -117,7 +117,8 @@ SYSCALL_DEFINE(fadvise64_64)(int fd, loff_t offset, loff_t len, int advice) break; case POSIX_FADV_DONTNEED: if (!bdi_write_congested(mapping->backing_dev_info)) - filemap_flush(mapping); + __filemap_fdatawrite_range(mapping, offset, endbyte, + WB_SYNC_NONE); /* First and last FULL page! */ start_index = (offset+(PAGE_CACHE_SIZE-1)) >> PAGE_CACHE_SHIFT;