From: Takaya Saeki Date: Tue, 3 Sep 2024 10:21:00 +0000 (+0000) Subject: filemap: fix the last_index of mm_filemap_get_pages X-Git-Tag: v6.12-rc1~115^2~60 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fc1b43c422f3deee0cfc221b071c3863dc077646;p=thirdparty%2Fkernel%2Flinux.git filemap: fix the last_index of mm_filemap_get_pages In commit b6273b55d885 ("filemap: add trace events for get_pages, map_pages, and fault"), mm_filemap_get_pages was added to trace page cache access. However, it tracks an extra page beyond the end of the accessed range. This patch fixes it by replacing last_index with last_index - 1. Link: https://lkml.kernel.org/r/20240903102100.70405-1-takayas@chromium.org Fixes: b6273b55d885 ("filemap: add trace events for get_pages, map_pages, and fault") Signed-off-by: Takaya Saeki Cc: Junichi Uekawa Cc: Masami Hiramatsu Cc: Mathieu Desnoyers Cc: Matthew Wilcox Cc: Steven Rostedt (Google) Signed-off-by: Andrew Morton --- diff --git a/mm/filemap.c b/mm/filemap.c index 88a2ed0084748..7eb4637ea199c 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2567,7 +2567,7 @@ retry: goto err; } - trace_mm_filemap_get_pages(mapping, index, last_index); + trace_mm_filemap_get_pages(mapping, index, last_index - 1); return 0; err: if (err < 0)