From: Nick Piggin A change to make database style random read() workloads perform better, by calling mark_page_accessed for some non-page-aligned reads broke the case of < PAGE_CACHE_SIZE files, which will not get their prev_index moved past the first page. Combine both heuristics for marking the page accessed. Signed-off-by: Nick Piggin Signed-off-by: Andrew Morton --- mm/filemap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff -puN mm/filemap.c~mm-filemapc-fix-mark_page_accessed-logic mm/filemap.c --- a/mm/filemap.c~mm-filemapc-fix-mark_page_accessed-logic +++ a/mm/filemap.c @@ -928,7 +928,7 @@ page_ok: * When (part of) the same page is read multiple times * in succession, only mark it as accessed the first time. */ - if (prev_index != index) + if (prev_index != index || !offset) mark_page_accessed(page); prev_index = index; _