]> git.baikalelectronics.ru Git - kernel.git/commit
filemap: Correct the conditions for marking a folio as accessed
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Fri, 10 Jun 2022 18:44:41 +0000 (14:44 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 20 Jun 2022 20:37:45 +0000 (16:37 -0400)
commit993243ed4ede2344b96d5c5e9f6f4100db78f410
tree8c1cf8edf223d2cec883a700bc3ce8106f39beb2
parente3bdeecd12bef6f299c01710d4161bc87e1a6823
filemap: Correct the conditions for marking a folio as accessed

We had an off-by-one error which meant that we never marked the first page
in a read as accessed.  This was visible as a slowdown when re-reading
a file as pages were being evicted from cache too soon.  In reviewing
this code, we noticed a second bug where a multi-page folio would be
marked as accessed multiple times when doing reads that were less than
the size of the folio.

Abstract the comparison of whether two file positions are in the same
folio into a new function, fixing both of these bugs.

Reported-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
mm/filemap.c