summaryrefslogtreecommitdiffstats
path: root/mm/madvise.c
diff options
context:
space:
mode:
authorJan Kara2017-07-11 00:48:59 +0200
committerLinus Torvalds2017-07-11 01:32:32 +0200
commit76b6f9b7edccdfcc7ad1588f24ba01e19db725f3 (patch)
tree2ba969d540076d52ceee35c6d690dec4ac0158b9 /mm/madvise.c
parentmm/hugetlb.c: replace memfmt with string_get_size (diff)
downloadkernel-qcow2-linux-76b6f9b7edccdfcc7ad1588f24ba01e19db725f3.tar.gz
kernel-qcow2-linux-76b6f9b7edccdfcc7ad1588f24ba01e19db725f3.tar.xz
kernel-qcow2-linux-76b6f9b7edccdfcc7ad1588f24ba01e19db725f3.zip
mm/truncate.c: fix THP handling in invalidate_mapping_pages()
The condition checking for THP straddling end of invalidated range is wrong - it checks 'index' against 'end' but 'index' has been already advanced to point to the end of THP and thus the condition can never be true. As a result THP straddling 'end' has been fully invalidated. Given the nature of invalidate_mapping_pages(), this could be only performance issue. In fact, we are lucky the condition is wrong because if it was ever true, we'd leave locked page behind. Fix the condition checking for THP straddling 'end' and also properly unlock the page. Also update the comment before the condition to explain why we decide not to invalidate the page as it was not clear to me and I had to ask Kirill. Link: http://lkml.kernel.org/r/20170619124723.21656-1-jack@suse.cz Signed-off-by: Jan Kara <jack@suse.cz> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/madvise.c')
0 files changed, 0 insertions, 0 deletions