linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yin Fengwei <fengwei.yin@intel.com>
To: Mike Kravetz <mike.kravetz@oracle.com>,
	kernel test robot <oliver.sang@intel.com>
Cc: <oe-lkp@lists.linux.dev>, <lkp@intel.com>,
	<linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ackerley Tng <ackerleytng@google.com>,
	Erdem Aktas <erdemaktas@google.com>,
	Matthew Wilcox <willy@infradead.org>,
	Muchun Song <songmuchun@bytedance.com>,
	"Sidhartha Kumar" <sidhartha.kumar@oracle.com>,
	Vishal Annapurve <vannapurve@google.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	<linux-fsdevel@vger.kernel.org>, <ying.huang@intel.com>,
	<feng.tang@intel.com>
Subject: Re: [linus:master] [page cache] 9425c591e0: vm-scalability.throughput -20.0% regression
Date: Tue, 27 Jun 2023 12:38:59 +0800	[thread overview]
Message-ID: <eda0d716-4292-6117-b036-4df64c5df110@intel.com> (raw)
In-Reply-To: <126cb393-31aa-d27f-ac0e-f86724eae0db@intel.com>



On 6/26/23 17:05, Yin, Fengwei wrote:
> Hi Mike,
> 
>> On 06/21/23 15:19, kernel test robot wrote:
>   <snip> 
>> I suspected this change could impact page_cache_next/prev_miss users, but had
>> no idea how much.
>>
>> Unless someone sees something wrong in 9425c591e06a, the best approach
>> might be to revert and then add a simple interface to check for 'folio at
>> a given index in the cache' as suggested by Ackerley Tng.
>> https://lore.kernel.org/linux-mm/98624c2f481966492b4eb8272aef747790229b73.1683069252.git.ackerleytng@google.com/
> 
> Some findings in my side.
> 1. You patch impact the folio order for file readahead. I collect the histogram of
>    order parameter to filemap_alloc_folio() call w/o your patch:
> 
>    With your patch:
>      page order    : count     distribution
>         0          : 892073   |                                        |
>         1          : 0        |                                        |
>         2          : 65120457 |****************************************|
>         3          : 32914005 |********************                    |
>         4          : 33020991 |********************                    |
> 
>    Without your patch:
>      page order    : count     distribution
>         0          : 3417288  |****                                    |
>         1          : 0        |                                        |
>         2          : 877012   |*                                       |
>         3          : 288      |                                        |
>         4          : 5607522  |*******                                 |
>         5          : 29974228 |****************************************|
> 
>    We could see the order 5 dominate the filemap folio without your patch. With your
>    patch, order 2,3,4 are most used for filemap folio.
> 
> 2. My understanding is your patch is correct and shouldn't be reverted. I made
>    a small change based on your patch. The performance regression is gone.
> 
> diff --git a/mm/readahead.c b/mm/readahead.c
> index 47afbca1d122..cca333f9b560 100644
> --- a/mm/readahead.c
> +++ b/mm/readahead.c
> @@ -610,7 +610,7 @@ static void ondemand_readahead(struct readahead_control *ractl,
>                 pgoff_t start;
> 
>                 rcu_read_lock();
> -               start = page_cache_next_miss(ractl->mapping, index + 1,
> +               start = page_cache_next_miss(ractl->mapping, index,
>                                 max_pages);
>                 rcu_read_unlock();
> 
>    And the filemap folio order is restored also:
>      page order    : count     distribution
>         0          : 3357622  |****                                    |
>         1          : 0        |                                        |
>         2          : 861726   |*                                       |
>         3          : 285      |                                        |
>         4          : 4511637  |*****                                   |
>         5          : 30505713 |****************************************|
> 
>    I still didn't figure out why this simple change can restore the performance.
>    And why index + 1 was used. Will check more.

The thing is the ra initialization after page_cache_next_miss() in function
ondemand_readahead():
  ra->start = start; (start is index + max_pages + 1 + 1 after your patch)
  ra->size = start - index;

And +1 will be accumulated to ra->start and breaks the filemap folio order.


Regards
Yin, Fengwei

> 
> 
> Regards
> Yin, Fengwei

  reply	other threads:[~2023-06-27  4:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-21  7:19 [linus:master] [page cache] 9425c591e0: vm-scalability.throughput -20.0% regression kernel test robot
2023-06-21 15:28 ` Mike Kravetz
2023-06-26  9:05   ` Yin, Fengwei
2023-06-27  4:38     ` Yin Fengwei [this message]
2023-06-23 12:36 ` Linux regression tracking #adding (Thorsten Leemhuis)

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=eda0d716-4292-6117-b036-4df64c5df110@intel.com \
    --to=fengwei.yin@intel.com \
    --cc=ackerleytng@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=erdemaktas@google.com \
    --cc=feng.tang@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=mike.kravetz@oracle.com \
    --cc=oe-lkp@lists.linux.dev \
    --cc=oliver.sang@intel.com \
    --cc=sidhartha.kumar@oracle.com \
    --cc=songmuchun@bytedance.com \
    --cc=vannapurve@google.com \
    --cc=willy@infradead.org \
    --cc=ying.huang@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).