All of lore.kernel.org
 help / color / mirror / Atom feed
* + mm-filemapc-fix-the-timing-of-asignment-of-prev_pos.patch added to mm-hotfixes-unstable branch
@ 2022-08-17 15:18 Andrew Morton
  2022-08-18 13:25 ` Matthew Wilcox
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Morton @ 2022-08-17 15:18 UTC (permalink / raw)
  To: mm-commits, willy, kent.overstreet, kanie, akpm


The patch titled
     Subject: mm/filemap.c: fix the timing of asignment of prev_pos
has been added to the -mm mm-hotfixes-unstable branch.  Its filename is
     mm-filemapc-fix-the-timing-of-asignment-of-prev_pos.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-filemapc-fix-the-timing-of-asignment-of-prev_pos.patch

This patch will later appear in the mm-hotfixes-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days

------------------------------------------------------
From: Guixin Liu <kanie@linux.alibaba.com>
Subject: mm/filemap.c: fix the timing of asignment of prev_pos
Date: Wed, 17 Aug 2022 21:51:57 +0800

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.

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.

Link: https://lkml.kernel.org/r/1660744317-8183-1-git-send-email-kanie@linux.alibaba.com
Fixes: 06c0444290cec ("mm/filemap.c: generic_file_buffered_read() now uses find_get_pages_contig")
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/filemap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/mm/filemap.c~mm-filemapc-fix-the-timing-of-asignment-of-prev_pos
+++ a/mm/filemap.c
@@ -2711,8 +2711,8 @@ ssize_t filemap_read(struct kiocb *iocb,
 			copied = copy_folio_to_iter(folio, offset, bytes, iter);
 
 			already_read += copied;
-			iocb->ki_pos += copied;
 			ra->prev_pos = iocb->ki_pos;
+			iocb->ki_pos += copied;
 
 			if (copied < bytes) {
 				error = -EFAULT;
_

Patches currently in -mm which might be from kanie@linux.alibaba.com are

mm-filemapc-fix-the-timing-of-asignment-of-prev_pos.patch


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: + mm-filemapc-fix-the-timing-of-asignment-of-prev_pos.patch added to mm-hotfixes-unstable branch
  2022-08-17 15:18 + mm-filemapc-fix-the-timing-of-asignment-of-prev_pos.patch added to mm-hotfixes-unstable branch Andrew Morton
@ 2022-08-18 13:25 ` Matthew Wilcox
  0 siblings, 0 replies; 2+ messages in thread
From: Matthew Wilcox @ 2022-08-18 13:25 UTC (permalink / raw)
  To: Andrew Morton; +Cc: mm-commits, kent.overstreet, kanie

On Wed, Aug 17, 2022 at 08:18:14AM -0700, Andrew Morton wrote:
> The patch titled
>      Subject: mm/filemap.c: fix the timing of asignment of prev_pos
> has been added to the -mm mm-hotfixes-unstable branch.  Its filename is
>      mm-filemapc-fix-the-timing-of-asignment-of-prev_pos.patch

Please drop this patch.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-18 13:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-17 15:18 + mm-filemapc-fix-the-timing-of-asignment-of-prev_pos.patch added to mm-hotfixes-unstable branch Andrew Morton
2022-08-18 13:25 ` Matthew Wilcox

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.