alibaba/ali_kernel — pull request #62 by gnehzuil (2014-04-08 05:29:09+00:00)
Title: 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.

[Note from Zheng Liu]
We backport this patch because we met a hang in RDS. In MySQL 5.5 it
calls fadvise64 with _DONTNEED flag to evict the page cache against an
inode in order to simulate an effect like direct IO. But in 2.6.32
kernel we will call filemap_flush() to flush all dirty pages. So it
cause that the kernel needs to write out a huge number of dirty pages.
Meanwhile due to using blk-throttle the write iops is limited to a
very low level (e.g. 600 iops). That means that the kernel needs to
take a lot of time to write out this data. Thus, it is easy to cause
the system hang.

Reference: ad8a1b558e6c76fb53901956d3c8f29b82a4ccfa
Patch-in-mainline: v3.2-4893-gad8a1b558e6c
Signed-off-by: Shawn Bohrer
Acked-by: Johannes Weiner
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
Signed-off-by: Zheng Liu