Commit fc1b43c4 authored by Takaya Saeki's avatar Takaya Saeki Committed by Andrew Morton

filemap: fix the last_index of mm_filemap_get_pages

In commit b6273b55 ("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: b6273b55 ("filemap: add trace events for get_pages, map_pages, and fault")
Signed-off-by: default avatarTakaya Saeki <takayas@chromium.org>
Cc: Junichi Uekawa <uekawa@chromium.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent e1e4cfd0
...@@ -2567,7 +2567,7 @@ static int filemap_get_pages(struct kiocb *iocb, size_t count, ...@@ -2567,7 +2567,7 @@ static int filemap_get_pages(struct kiocb *iocb, size_t count,
goto err; goto err;
} }
trace_mm_filemap_get_pages(mapping, index, last_index); trace_mm_filemap_get_pages(mapping, index, last_index - 1);
return 0; return 0;
err: err:
if (err < 0) if (err < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment