All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] RESEND fix page_cache_next/prev_miss off by one error
@ 2023-06-02 22:57 Mike Kravetz
  2023-06-02 22:57 ` [PATCH 1/1] page cache: fix page_cache_next/prev_miss off by one Mike Kravetz
  2023-06-03  0:55 ` [PATCH 0/1] RESEND fix page_cache_next/prev_miss off by one error Andrew Morton
  0 siblings, 2 replies; 10+ messages in thread
From: Mike Kravetz @ 2023-06-02 22:57 UTC (permalink / raw)
  To: linux-kernel, linux-mm, linux-fsdevel
  Cc: Matthew Wilcox, Ackerley Tng, Sidhartha Kumar, Muchun Song,
	vannapurve, erdemaktas, Andrew Morton, Mike Kravetz

In commits d0ce0e47b323 and 91a2fb956ad99, hugetlb code was changed to
use page_cache_next_miss to determine if a page was present in the page
cache.  However, the current implementation of page_cache_next_miss will
always return the passed index if max_scan is 1 as in the hugetlb code.
As a result, hugetlb code will always thing a page is present in the
cache, even if that is not the case.

The patch which follows addresses the issue by changing the implementation
of page_cache_next_miss and for consistency page_cache_prev_miss.  Since
such a patch also impacts the readahead code, I would suggest using the
patch by Sidhartha Kumar [1] to fix the issue in 6.3 and this patch moving
forward.

If we would rather not modify page_cache_next/prev_miss, then a new
interface as suggested by Ackerley Tng [2] could also be used.

Comments on the best way to fix moving forward would be appreciated.

[1] https://lore.kernel.org/linux-mm/20230505185301.534259-1-sidhartha.kumar@oracle.com/
[2] https://lore.kernel.org/linux-mm/98624c2f481966492b4eb8272aef747790229b73.1683069252.git.ackerleytng@google.com/

Mike Kravetz (1):
  page cache: fix page_cache_next/prev_miss off by one

 mm/filemap.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

-- 
2.40.1


^ permalink raw reply	[flat|nested] 10+ messages in thread
* [PATCH 0/1] fix page_cache_next/prev_miss off by one error
@ 2023-05-04 23:38 Mike Kravetz
  2023-05-04 23:38 ` [PATCH 1/1] page cache: fix page_cache_next/prev_miss off by one Mike Kravetz
  0 siblings, 1 reply; 10+ messages in thread
From: Mike Kravetz @ 2023-05-04 23:38 UTC (permalink / raw)
  To: linux-kernel, linux-mm, linux-fsdevel
  Cc: Matthew Wilcox, Ackerley Tng, Sidhartha Kumar, Muchun Song,
	vannapurve, erdemaktas, Andrew Morton, Mike Kravetz

A cover letter is not necessary for this single patch as all information
is present in the commit message.  However, I am not 100% comfortable in
this change and would REALLY like to get comments from Matthew.

When reporting this issue, Ackerley Tng suggested a solution by creating
a new filemap_has_folio() function[1].  I believe that would be an
acceptable way to proceed although we would also need to change the
other use of page_cache_next_miss in hugetlb.c.

When looking more closely, it looks like page_cache_next/prev_miss do
not work exactly as described.  The result is the following patch.

IIUC, prior to hugetlb use of page_cache_next/prev_miss, it was only
used by readahead code.  My patch does change the return value and has
potential to impact the readahead users.  That is why I am not 100%
comfortable with this.

In any case, this is broken in v6.3 so we need a fix.

[1] https://lore.kernel.org/linux-mm/cover.1683069252.git.ackerleytng@google.com/
Mike Kravetz (1):
  page cache: fix page_cache_next/prev_miss off by one

 mm/filemap.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

-- 
2.40.0


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

end of thread, other threads:[~2023-06-06 23:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-02 22:57 [PATCH 0/1] RESEND fix page_cache_next/prev_miss off by one error Mike Kravetz
2023-06-02 22:57 ` [PATCH 1/1] page cache: fix page_cache_next/prev_miss off by one Mike Kravetz
2023-06-03  0:59   ` Andrew Morton
2023-06-03  2:24     ` Mike Kravetz
2023-06-05 17:26   ` Ackerley Tng
2023-06-06 22:41     ` Mike Kravetz
2023-06-06 23:35       ` Ackerley Tng
2023-06-03  0:55 ` [PATCH 0/1] RESEND fix page_cache_next/prev_miss off by one error Andrew Morton
2023-06-03  2:22   ` Mike Kravetz
  -- strict thread matches above, loose matches on Subject: below --
2023-05-04 23:38 [PATCH 0/1] " Mike Kravetz
2023-05-04 23:38 ` [PATCH 1/1] page cache: fix page_cache_next/prev_miss off by one Mike Kravetz

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.