linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Hillf Danton" <hillf.zj@alibaba-inc.com>
To: 'Mel Gorman' <mgorman@techsingularity.net>
Cc: 'Andrew Morton' <akpm@linux-foundation.org>,
	'Shantanu Goel' <sgoel01@yahoo.com>, 'Chris Mason' <clm@fb.com>,
	'Johannes Weiner' <hannes@cmpxchg.org>,
	'Vlastimil Babka' <vbabka@suse.cz>,
	'LKML' <linux-kernel@vger.kernel.org>,
	'Linux-MM' <linux-mm@kvack.org>
Subject: Re: [PATCH 3/3] mm, vmscan: Prevent kswapd sleeping prematurely due to mismatched classzone_idx
Date: Thu, 16 Feb 2017 16:21:04 +0800	[thread overview]
Message-ID: <001f01d2882d$9dd14850$d973d8f0$@alibaba-inc.com> (raw)
In-Reply-To: <20170216081039.ukbxl2b4khnwwbic@techsingularity.net>


On February 16, 2017 4:11 PM Mel Gorman wrote:
> On Thu, Feb 16, 2017 at 02:23:08PM +0800, Hillf Danton wrote:
> > On February 15, 2017 5:23 PM Mel Gorman wrote:
> > >   */
> > >  static int kswapd(void *p)
> > >  {
> > > -	unsigned int alloc_order, reclaim_order, classzone_idx;
> > > +	unsigned int alloc_order, reclaim_order;
> > > +	unsigned int classzone_idx = MAX_NR_ZONES - 1;
> > >  	pg_data_t *pgdat = (pg_data_t*)p;
> > >  	struct task_struct *tsk = current;
> > >
> > > @@ -3447,20 +3466,23 @@ static int kswapd(void *p)
> > >  	tsk->flags |= PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD;
> > >  	set_freezable();
> > >
> > > -	pgdat->kswapd_order = alloc_order = reclaim_order = 0;
> > > -	pgdat->kswapd_classzone_idx = classzone_idx = 0;
> > > +	pgdat->kswapd_order = 0;
> > > +	pgdat->kswapd_classzone_idx = MAX_NR_ZONES;
> > >  	for ( ; ; ) {
> > >  		bool ret;
> > >
> > > +		alloc_order = reclaim_order = pgdat->kswapd_order;
> > > +		classzone_idx = kswapd_classzone_idx(pgdat, classzone_idx);
> > > +
> > >  kswapd_try_sleep:
> > >  		kswapd_try_to_sleep(pgdat, alloc_order, reclaim_order,
> > >  					classzone_idx);
> > >
> > >  		/* Read the new order and classzone_idx */
> > >  		alloc_order = reclaim_order = pgdat->kswapd_order;
> > > -		classzone_idx = pgdat->kswapd_classzone_idx;
> > > +		classzone_idx = kswapd_classzone_idx(pgdat, 0);
> > >  		pgdat->kswapd_order = 0;
> > > -		pgdat->kswapd_classzone_idx = 0;
> > > +		pgdat->kswapd_classzone_idx = MAX_NR_ZONES;
> > >
> > >  		ret = try_to_freeze();
> > >  		if (kthread_should_stop())
> > > @@ -3486,9 +3508,6 @@ static int kswapd(void *p)
> > >  		reclaim_order = balance_pgdat(pgdat, alloc_order, classzone_idx);
> > >  		if (reclaim_order < alloc_order)
> > >  			goto kswapd_try_sleep;
> >
> > If we fail order-5 request,  can we then give up order-5, and
> > try order-3 if requested, after napping?
> >
> 
> That has no bearing upon this patch. At this point, kswapd has stopped
> reclaiming at the requested order and is preparing to sleep. If there is
> a parallel request for order-3 while it's sleeping, it'll wake and start
> reclaiming at order-3 as requested.
> 
Right, but the order-3 request can also come up while kswapd is active and
gives up order-5.

thanks
Hillf

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2017-02-16  8:21 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-15  9:22 [PATCH 0/3] Reduce amount of time kswapd sleeps prematurely Mel Gorman
2017-02-15  9:22 ` [PATCH 1/3] mm, vmscan: fix zone balance check in prepare_kswapd_sleep Mel Gorman
2017-02-16  2:50   ` Hillf Danton
2017-02-22  7:00   ` Minchan Kim
2017-02-23 15:05     ` Mel Gorman
2017-02-24  1:17       ` Minchan Kim
2017-02-24  9:11         ` Mel Gorman
2017-02-27  6:16           ` Minchan Kim
2017-02-15  9:22 ` [PATCH 2/3] mm, vmscan: Only clear pgdat congested/dirty/writeback state when balanced Mel Gorman
2017-02-15  9:22 ` [PATCH 3/3] mm, vmscan: Prevent kswapd sleeping prematurely due to mismatched classzone_idx Mel Gorman
2017-02-16  6:23   ` Hillf Danton
2017-02-16  8:10     ` Mel Gorman
2017-02-16  8:21       ` Hillf Danton [this message]
2017-02-16  9:32         ` Mel Gorman
2017-02-20 16:34         ` Vlastimil Babka
2017-02-21  4:10           ` Hillf Danton
2017-02-20 16:42   ` Vlastimil Babka
2017-02-23 15:01     ` Mel Gorman
2017-03-01  9:04       ` Vlastimil Babka
2017-02-15 20:30 ` [PATCH 0/3] Reduce amount of time kswapd sleeps prematurely Andrew Morton
2017-02-15 21:29   ` Mel Gorman
2017-02-15 21:56     ` Andrew Morton
2017-02-15 22:15       ` Mel Gorman
2017-02-15 22:00     ` Vlastimil Babka
2017-03-09  7:56 [PATCH 0/3] Reduce amount of time kswapd sleeps prematurely v2 Mel Gorman
2017-03-09  7:56 ` [PATCH 3/3] mm, vmscan: Prevent kswapd sleeping prematurely due to mismatched classzone_idx Mel Gorman

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='001f01d2882d$9dd14850$d973d8f0$@alibaba-inc.com' \
    --to=hillf.zj@alibaba-inc.com \
    --cc=akpm@linux-foundation.org \
    --cc=clm@fb.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=sgoel01@yahoo.com \
    --cc=vbabka@suse.cz \
    /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