All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mel Gorman <mgorman@techsingularity.net>
To: lkp@lists.01.org
Subject: Re: [mm/page_alloc] f26b3fa046: netperf.Throughput_Mbps -18.0% regression
Date: Thu, 05 May 2022 12:09:47 +0100	[thread overview]
Message-ID: <20220505110947.GD3441@techsingularity.net> (raw)
In-Reply-To: <YnOKWNE3PZzzohNH@ziqianlu-desk1>

[-- Attachment #1: Type: text/plain, Size: 2068 bytes --]

On Thu, May 05, 2022 at 04:27:04PM +0800, Aaron Lu wrote:
> On Fri, Apr 29, 2022 at 02:39:18PM +0100, Mel Gorman wrote:
> > On Fri, Apr 29, 2022 at 07:29:19PM +0800, Aaron Lu wrote:
> 
> ... ...
> 
> > > The said change looks like this:
> > > (relevant comment will have to be adjusted)
> > > 
> > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > > index 505d59f7d4fa..130a02af8321 100644
> > > --- a/mm/page_alloc.c
> > > +++ b/mm/page_alloc.c
> > > @@ -3332,18 +3332,19 @@ static int nr_pcp_high(struct per_cpu_pages *pcp, struct zone *zone,
> > >  		       bool free_high)
> > >  {
> > >  	int high = READ_ONCE(pcp->high);
> > > +	int batch = READ_ONCE(pcp->batch);
> > >  
> > > -	if (unlikely(!high || free_high))
> > > +	if (unlikely(!high))
> > >  		return 0;
> > >  
> > > -	if (!test_bit(ZONE_RECLAIM_ACTIVE, &zone->flags))
> > > -		return high;
> > > -
> > >  	/*
> > >  	 * If reclaim is active, limit the number of pages that can be
> > >  	 * stored on pcp lists
> > >  	 */
> > > -	return min(READ_ONCE(pcp->batch) << 2, high);
> > > +	if (test_bit(ZONE_RECLAIM_ACTIVE, &zone->flags) || free_high)
> > > +		return min(batch << 2, high);
> > > +
> > > +	return high;
> > >  }
> > >  
> > >  static void free_unref_page_commit(struct page *page, int migratetype,
> > > 
> > > Does this look sane? If so, I can prepare a formal patch with proper
> > > comment and changelog, thanks.
> > 
> > I think it looks reasonable sane. The corner case is that if
> > ((high - (batch >> 2)) > cachesize) that the pages will not get recycled
> 
> When free_high is true, the above diff changed the return value of
> nr_pcp_high() from 0 to min(batch << 2, pcp->high) so the corner case is
> when (min(batch << 2, pcp->high) > cachesize)?
> 

Yes. It's not perfect due to cache aliasing so the actual point where it
matters will be variable. Whatever the value is, there a value where the
corner case applies that pages do not get recycled quickly enough and
are no longer cache-hot.

-- 
Mel Gorman
SUSE Labs

WARNING: multiple messages have this Message-ID (diff)
From: Mel Gorman <mgorman@techsingularity.net>
To: Aaron Lu <aaron.lu@intel.com>
Cc: kernel test robot <oliver.sang@intel.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Vlastimil Babka <vbabka@suse.cz>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Jesper Dangaard Brouer <brouer@redhat.com>,
	Michal Hocko <mhocko@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	lkp@lists.01.org, lkp@intel.com, ying.huang@intel.com,
	feng.tang@intel.com, zhengjun.xing@linux.intel.com,
	fengwei.yin@intel.com
Subject: Re: [mm/page_alloc]  f26b3fa046:  netperf.Throughput_Mbps -18.0% regression
Date: Thu, 5 May 2022 12:09:47 +0100	[thread overview]
Message-ID: <20220505110947.GD3441@techsingularity.net> (raw)
In-Reply-To: <YnOKWNE3PZzzohNH@ziqianlu-desk1>

On Thu, May 05, 2022 at 04:27:04PM +0800, Aaron Lu wrote:
> On Fri, Apr 29, 2022 at 02:39:18PM +0100, Mel Gorman wrote:
> > On Fri, Apr 29, 2022 at 07:29:19PM +0800, Aaron Lu wrote:
> 
> ... ...
> 
> > > The said change looks like this:
> > > (relevant comment will have to be adjusted)
> > > 
> > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > > index 505d59f7d4fa..130a02af8321 100644
> > > --- a/mm/page_alloc.c
> > > +++ b/mm/page_alloc.c
> > > @@ -3332,18 +3332,19 @@ static int nr_pcp_high(struct per_cpu_pages *pcp, struct zone *zone,
> > >  		       bool free_high)
> > >  {
> > >  	int high = READ_ONCE(pcp->high);
> > > +	int batch = READ_ONCE(pcp->batch);
> > >  
> > > -	if (unlikely(!high || free_high))
> > > +	if (unlikely(!high))
> > >  		return 0;
> > >  
> > > -	if (!test_bit(ZONE_RECLAIM_ACTIVE, &zone->flags))
> > > -		return high;
> > > -
> > >  	/*
> > >  	 * If reclaim is active, limit the number of pages that can be
> > >  	 * stored on pcp lists
> > >  	 */
> > > -	return min(READ_ONCE(pcp->batch) << 2, high);
> > > +	if (test_bit(ZONE_RECLAIM_ACTIVE, &zone->flags) || free_high)
> > > +		return min(batch << 2, high);
> > > +
> > > +	return high;
> > >  }
> > >  
> > >  static void free_unref_page_commit(struct page *page, int migratetype,
> > > 
> > > Does this look sane? If so, I can prepare a formal patch with proper
> > > comment and changelog, thanks.
> > 
> > I think it looks reasonable sane. The corner case is that if
> > ((high - (batch >> 2)) > cachesize) that the pages will not get recycled
> 
> When free_high is true, the above diff changed the return value of
> nr_pcp_high() from 0 to min(batch << 2, pcp->high) so the corner case is
> when (min(batch << 2, pcp->high) > cachesize)?
> 

Yes. It's not perfect due to cache aliasing so the actual point where it
matters will be variable. Whatever the value is, there a value where the
corner case applies that pages do not get recycled quickly enough and
are no longer cache-hot.

-- 
Mel Gorman
SUSE Labs

  reply	other threads:[~2022-05-05 11:09 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-20  1:35 [mm/page_alloc] f26b3fa046: netperf.Throughput_Mbps -18.0% regression kernel test robot
2022-04-20  1:35 ` kernel test robot
2022-04-29 11:29 ` Aaron Lu
2022-04-29 11:29   ` Aaron Lu
2022-04-29 13:39   ` Mel Gorman
2022-04-29 13:39     ` Mel Gorman
2022-05-05  8:27     ` Aaron Lu
2022-05-05  8:27       ` Aaron Lu
2022-05-05 11:09       ` Mel Gorman [this message]
2022-05-05 11:09         ` Mel Gorman
2022-05-05 14:29         ` Aaron Lu
2022-05-05 14:29           ` Aaron Lu
2022-05-06  8:40   ` ying.huang
2022-05-06  8:40     ` ying.huang
2022-05-06 12:17     ` Aaron Lu
2022-05-06 12:17       ` Aaron Lu
2022-05-07  0:54       ` ying.huang
2022-05-07  0:54         ` ying.huang
2022-05-07  3:27         ` Aaron Lu
2022-05-07  3:27           ` Aaron Lu
2022-05-07  7:11           ` ying.huang
2022-05-07  7:11             ` ying.huang
2022-05-07  7:31             ` Aaron Lu
2022-05-07  7:31               ` Aaron Lu
2022-05-07  7:44               ` ying.huang
2022-05-07  7:44                 ` ying.huang
2022-05-10  3:43                 ` Aaron Lu
2022-05-10  3:43                   ` Aaron Lu
2022-05-10  6:23                   ` ying.huang
2022-05-10  6:23                     ` ying.huang
2022-05-10 18:05                     ` Linus Torvalds
2022-05-10 18:05                       ` Linus Torvalds
2022-05-10 18:47                       ` Waiman Long
2022-05-10 18:47                         ` Waiman Long
2022-05-10 19:03                         ` Linus Torvalds
2022-05-10 19:03                           ` Linus Torvalds
2022-05-10 19:25                           ` Linus Torvalds
2022-05-10 19:25                             ` Linus Torvalds
2022-05-10 19:46                           ` Waiman Long
2022-05-10 19:46                             ` Waiman Long
2022-05-10 19:27                       ` Peter Zijlstra
2022-05-10 19:27                         ` Peter Zijlstra
2022-05-11  1:58                       ` ying.huang
2022-05-11  1:58                         ` ying.huang
2022-05-11  2:06                         ` Waiman Long
2022-05-11  2:06                           ` Waiman Long
2022-05-11 11:04                         ` Aaron Lu
2022-05-11 11:04                           ` Aaron Lu
2022-05-12  3:17                           ` ying.huang
2022-05-12  3:17                             ` ying.huang
2022-05-12 12:45                             ` Aaron Lu
2022-05-12 12:45                               ` Aaron Lu
2022-05-12 17:42                               ` Linus Torvalds
2022-05-12 17:42                                 ` Linus Torvalds
2022-05-12 18:06                                 ` Andrew Morton
2022-05-12 18:06                                   ` Andrew Morton
2022-05-12 18:49                                   ` Linus Torvalds
2022-05-12 18:49                                     ` Linus Torvalds
2022-06-14  2:09                                     ` Feng Tang
2022-06-14  2:09                                       ` Feng Tang
2022-05-13  6:19                                 ` ying.huang
2022-05-13  6:19                                   ` ying.huang
2022-05-11  3:40                     ` Aaron Lu
2022-05-11  3:40                       ` Aaron Lu
2022-05-11  7:32                       ` ying.huang
2022-05-11  7:32                         ` ying.huang
2022-05-11  7:53                         ` Aaron Lu
2022-05-11  7:53                           ` Aaron Lu
2022-06-01  2:19                           ` Aaron Lu
2022-06-01  2:19                             ` Aaron Lu
2022-05-11 12:13 ` [mm/page_alloc] f26b3fa046: netperf.Throughput_Mbps -18.0% regression #forregzbot Thorsten Leemhuis
2022-05-13  8:37   ` Thorsten Leemhuis
2022-09-08 11:39     ` 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=20220505110947.GD3441@techsingularity.net \
    --to=mgorman@techsingularity.net \
    --cc=lkp@lists.01.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 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.