Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1582376

Re: [PATCH 3/3] mm, vmscan: Prevent kswapd sleeping prematurely due to mismatched classzone_idx

From Mel Gorman <mgorman@techsingularity.net>
Newsgroups linux.kernel
Subject Re: [PATCH 3/3] mm, vmscan: Prevent kswapd sleeping prematurely due to mismatched classzone_idx
Date 2017-02-16 09:20 +0100
Message-ID <tbpse-3wB-11@gated-at.bofh.it> (permalink)
References <tb44p-6xD-5@gated-at.bofh.it> <tb44q-6xD-11@gated-at.bofh.it> <tbnJM-2fh-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

-- 
Mel Gorman
SUSE Labs

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] Reduce amount of time kswapd sleeps prematurely Mel Gorman <mgorman@techsingularity.net> - 2017-02-15 10:30 +0100
  [PATCH 2/3] mm, vmscan: Only clear pgdat congested/dirty/writeback state when balanced Mel Gorman <mgorman@techsingularity.net> - 2017-02-15 10:30 +0100
  [PATCH 3/3] mm, vmscan: Prevent kswapd sleeping prematurely due to mismatched classzone_idx Mel Gorman <mgorman@techsingularity.net> - 2017-02-15 10:30 +0100
    Re: [PATCH 3/3] mm, vmscan: Prevent kswapd sleeping prematurely due to mismatched classzone_idx "Hillf Danton" <hillf.zj@alibaba-inc.com> - 2017-02-16 07:30 +0100
      Re: [PATCH 3/3] mm, vmscan: Prevent kswapd sleeping prematurely due  to mismatched classzone_idx Mel Gorman <mgorman@techsingularity.net> - 2017-02-16 09:20 +0100
        Re: [PATCH 3/3] mm, vmscan: Prevent kswapd sleeping prematurely due to mismatched classzone_idx "Hillf Danton" <hillf.zj@alibaba-inc.com> - 2017-02-16 09:30 +0100
          Re: [PATCH 3/3] mm, vmscan: Prevent kswapd sleeping prematurely due  to mismatched classzone_idx Mel Gorman <mgorman@techsingularity.net> - 2017-02-16 10:40 +0100
          Re: [PATCH 3/3] mm, vmscan: Prevent kswapd sleeping prematurely due  to mismatched classzone_idx Vlastimil Babka <vbabka@suse.cz> - 2017-02-20 17:40 +0100
            Re: [PATCH 3/3] mm, vmscan: Prevent kswapd sleeping prematurely due to mismatched classzone_idx "Hillf Danton" <hillf.zj@alibaba-inc.com> - 2017-02-21 05:20 +0100
    Re: [PATCH 3/3] mm, vmscan: Prevent kswapd sleeping prematurely due  to mismatched classzone_idx Vlastimil Babka <vbabka@suse.cz> - 2017-02-20 17:50 +0100
      Re: [PATCH 3/3] mm, vmscan: Prevent kswapd sleeping prematurely due  to mismatched classzone_idx Mel Gorman <mgorman@techsingularity.net> - 2017-02-23 16:10 +0100
  Re: [PATCH 0/3] Reduce amount of time kswapd sleeps prematurely Andrew Morton <akpm@linux-foundation.org> - 2017-02-15 21:40 +0100
    Re: [PATCH 0/3] Reduce amount of time kswapd sleeps prematurely Mel Gorman <mgorman@techsingularity.net> - 2017-02-15 22:30 +0100
      Re: [PATCH 0/3] Reduce amount of time kswapd sleeps prematurely Andrew Morton <akpm@linux-foundation.org> - 2017-02-15 23:00 +0100
        Re: [PATCH 0/3] Reduce amount of time kswapd sleeps prematurely Mel Gorman <mgorman@techsingularity.net> - 2017-02-15 23:20 +0100
      Re: [PATCH 0/3] Reduce amount of time kswapd sleeps prematurely Vlastimil Babka <vbabka@suse.cz> - 2017-02-15 23:10 +0100

csiph-web