linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Backlund <tmb@tmb.nu>
To: Mike Kravetz <mike.kravetz@oracle.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-fsdevel@vger.kernel.org
Cc: Matthew Wilcox <willy@infradead.org>,
	Ackerley Tng <ackerleytng@google.com>,
	Sidhartha Kumar <sidhartha.kumar@oracle.com>,
	Muchun Song <songmuchun@bytedance.com>,
	Vishal Annapurve <vannapurve@google.com>,
	Erdem Aktas <erdemaktas@google.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	kernel test robot <oliver.sang@intel.com>
Subject: Re: [PATCH 1/2] Revert "page cache: fix page_cache_next/prev_miss off by one"
Date: Mon, 24 Jul 2023 12:15:17 +0000	[thread overview]
Message-ID: <bf744801-96a1-bdf1-79b5-5e8a21c05be3@tmb.nu> (raw)

Den 2023-06-22 kl. 00:24, skrev Mike Kravetz:
> This reverts commit 9425c591e06a9ab27a145ba655fb50532cf0bcc9
> 
> 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.
> 
> Reported-by: kernel test robot <oliver.sang@intel.com>
> Closes: https://lore.kernel.org/oe-lkp/202306211346.1e9ff03e-oliver.sang@intel.com
> Fixes: 9425c591e06a ("page cache: fix page_cache_next/prev_miss off by one")
> Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>


Should not this one be submitted to 6.4 stable branch too ?


git describe --contains 9425c591e06a
v6.4-rc7~29^2~1

The other one (hugetlb: revert use of page_cache_next_miss()) of this 
patch series landed in 6.4.2

Or am I missing something ?

--
Thomas

> ---
>   mm/filemap.c | 26 ++++++++++----------------
>   1 file changed, 10 insertions(+), 16 deletions(-)
> 
> diff --git a/mm/filemap.c b/mm/filemap.c
> index 3b73101f9f86..9e44a49bbd74 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -1728,9 +1728,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)
> @@ -1740,13 +1738,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);
>   
> @@ -1767,9 +1764,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)
> @@ -1779,13 +1774,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);
>   




             reply	other threads:[~2023-07-24 12:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-24 12:15 Thomas Backlund [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-06-21 21:24 Mike Kravetz
2023-06-21 22:15 ` Sidhartha Kumar
2023-06-21 22:18 ` Andrew Morton
2023-06-21 23:01   ` Mike Kravetz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bf744801-96a1-bdf1-79b5-5e8a21c05be3@tmb.nu \
    --to=tmb@tmb.nu \
    --cc=ackerleytng@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=erdemaktas@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.com \
    --cc=oliver.sang@intel.com \
    --cc=sidhartha.kumar@oracle.com \
    --cc=songmuchun@bytedance.com \
    --cc=vannapurve@google.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox