]> git.baikalelectronics.ru Git - kernel.git/commit
mm/fadvise.c: do not discard partial pages with POSIX_FADV_DONTNEED
authorOleg Drokin <green@linuxhacker.ru>
Wed, 8 Jun 2016 22:33:59 +0000 (15:33 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 9 Jun 2016 21:23:11 +0000 (14:23 -0700)
commit01751ea2b792c5a53e6628fa19af75ac89f6ab07
treec75be3a413a4fca8c2e0058d75df06a2c22610fa
parentf456d6ceff53f90956548f79c8fd5315c220603c
mm/fadvise.c: do not discard partial pages with POSIX_FADV_DONTNEED

I noticed that the logic in the fadvise64_64 syscall is incorrect for
partial pages.  While first page of the region is correctly skipped if
it is partial, the last page of the region is mistakenly discarded.
This leads to problems for applications that read data in
non-page-aligned chunks discarding already processed data between the
reads.

A somewhat misguided application that does something like write(XX bytes
(non-page-alligned)); drop the data it just wrote; repeat gets a
significant penalty in performance as a result.

Link: http://lkml.kernel.org/r/1464917140-1506698-1-git-send-email-green@linuxhacker.ru
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/fadvise.c