On Wed, Aug 17, 2022 at 08:16:57AM -0700, Andrew Morton wrote: > On Wed, 17 Aug 2022 21:51:57 +0800 Guixin Liu <kanie@xxxxxxxxxxxxxxxxx> wrote: > > > The prev_pos should be assigned before the iocb->ki_pos is incremented, > > so that the prev_pos is the exact location of the last visit. > > > > Fixes: 06c0444290cec ("mm/filemap.c: generic_file_buffered_read() now > > uses find_get_pages_contig") > > Signed-off-by: Guixin Liu <kanie@xxxxxxxxxxxxxxxxx> > > > > --- > > Hi guys, > > When I`m running repetitive 4k read io which has same offset, > > I find that access to folio_mark_accessed is inevitable in the > > read process, the reason is that the prev_pos is assigned after the > > iocb->ki_pos is incremented, so that the prev_pos is always not equal > > to the position currently visited. > > Is this a bug that needs fixing? > > It looks wrong to me and it does appear that 06c0444290cecf0 did this > unintentionally. That commit was the start of a problem, but I think I restored the original behaviour in 5ccc944dce3d. You were part of that discussion back in June: https://lore.kernel.org/linux-mm/20220602082129.2805890-1-yukuai3@xxxxxxxxxx/