filemap_read() writes the end of every read to file->f_ra.prev_pos. Threads that read through one open file all write that cache line, on every read. The value often stays the same, as for reads that start at the same offset each time. Store it only when it changes. Assisted-by: LLM Signed-off-by: Kiryl Shutsemau (Meta) --- mm/filemap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/filemap.c b/mm/filemap.c index 53ec92279977..960d53b61d4b 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2941,7 +2941,9 @@ ssize_t filemap_read(struct kiocb *iocb, struct iov_iter *iter, } while (iov_iter_count(iter) && iocb->ki_pos < isize && !error); file_accessed(filp); - ra->prev_pos = last_pos; + /* Readers sharing the file would bounce the line for nothing */ + if (ra->prev_pos != last_pos) + ra->prev_pos = last_pos; return already_read ? already_read : error; } EXPORT_SYMBOL_GPL(filemap_read); -- 2.54.0