mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
Revert "page cache: fix page_cache_next/prev_miss off by one"
commit16f8eb3eea
upstream. This reverts commit9425c591e0
The reverted commit fixed up routines primarily used by readahead code such that they could also be used by hugetlb. Unfortunately, this caused a performance regression as pointed out by the Closes: tag. The hugetlb code which uses page_cache_next_miss will be addressed in a subsequent patch. Link: https://lkml.kernel.org/r/20230621212403.174710-1-mike.kravetz@oracle.com Fixes:9425c591e0
("page cache: fix page_cache_next/prev_miss off by one") Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com> Reported-by: kernel test robot <oliver.sang@intel.com> Closes: https://lore.kernel.org/oe-lkp/202306211346.1e9ff03e-oliver.sang@intel.com Reviewed-by: Sidhartha Kumar <sidhartha.kumar@oracle.com> Cc: Ackerley Tng <ackerleytng@google.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Matthew Wilcox <willy@infradead.org> Cc: Muchun Song <songmuchun@bytedance.com> Cc: Vishal Annapurve <vannapurve@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
6df7dd9270
commit
5415dde3e7
1 changed files with 10 additions and 16 deletions
26
mm/filemap.c
26
mm/filemap.c
|
@ -1760,9 +1760,7 @@ bool __folio_lock_or_retry(struct folio *folio, struct mm_struct *mm,
|
|||
*
|
||||
* Return: The index of the gap if found, otherwise an index outside the
|
||||
* range specified (in which case 'return - index >= max_scan' will be true).
|
||||
* In the rare case of index wrap-around, 0 will be returned. 0 will also
|
||||
* be returned if index == 0 and there is a gap at the index. We can not
|
||||
* wrap-around if passed index == 0.
|
||||
* In the rare case of index wrap-around, 0 will be returned.
|
||||
*/
|
||||
pgoff_t page_cache_next_miss(struct address_space *mapping,
|
||||
pgoff_t index, unsigned long max_scan)
|
||||
|
@ -1772,13 +1770,12 @@ pgoff_t page_cache_next_miss(struct address_space *mapping,
|
|||
while (max_scan--) {
|
||||
void *entry = xas_next(&xas);
|
||||
if (!entry || xa_is_value(entry))
|
||||
return xas.xa_index;
|
||||
if (xas.xa_index == 0 && index != 0)
|
||||
return xas.xa_index;
|
||||
break;
|
||||
if (xas.xa_index == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
/* No gaps in range and no wrap-around, return index beyond range */
|
||||
return xas.xa_index + 1;
|
||||
return xas.xa_index;
|
||||
}
|
||||
EXPORT_SYMBOL(page_cache_next_miss);
|
||||
|
||||
|
@ -1799,9 +1796,7 @@ EXPORT_SYMBOL(page_cache_next_miss);
|
|||
*
|
||||
* Return: The index of the gap if found, otherwise an index outside the
|
||||
* range specified (in which case 'index - return >= max_scan' will be true).
|
||||
* In the rare case of wrap-around, ULONG_MAX will be returned. ULONG_MAX
|
||||
* will also be returned if index == ULONG_MAX and there is a gap at the
|
||||
* index. We can not wrap-around if passed index == ULONG_MAX.
|
||||
* In the rare case of wrap-around, ULONG_MAX will be returned.
|
||||
*/
|
||||
pgoff_t page_cache_prev_miss(struct address_space *mapping,
|
||||
pgoff_t index, unsigned long max_scan)
|
||||
|
@ -1811,13 +1806,12 @@ pgoff_t page_cache_prev_miss(struct address_space *mapping,
|
|||
while (max_scan--) {
|
||||
void *entry = xas_prev(&xas);
|
||||
if (!entry || xa_is_value(entry))
|
||||
return xas.xa_index;
|
||||
if (xas.xa_index == ULONG_MAX && index != ULONG_MAX)
|
||||
return xas.xa_index;
|
||||
break;
|
||||
if (xas.xa_index == ULONG_MAX)
|
||||
break;
|
||||
}
|
||||
|
||||
/* No gaps in range and no wrap-around, return index beyond range */
|
||||
return xas.xa_index - 1;
|
||||
return xas.xa_index;
|
||||
}
|
||||
EXPORT_SYMBOL(page_cache_prev_miss);
|
||||
|
||||
|
|
Loading…
Reference in a new issue