netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mel Gorman <mel-wPRd99KPJ+uzQB+pC5nmwQ@public.gmane.org>
To: KOSAKI Motohiro
	<kosaki.motohiro-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
Cc: Frans Pop <elendil-EIBgga6/0yRmR6Xm/wNWPw@public.gmane.org>,
	Jiri Kosina <jkosina-AlSwsSmVLrQ@public.gmane.org>,
	Sven Geggus
	<lists-+AJD3D7QEjjt/htJsj1pd9AswbaBtrod@public.gmane.org>,
	Karol Lewandowski
	<karol.k.lewandowski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Tobias Oetiker <tobi-7K0TWYW2a3pyDzI6CaY1VQ@public.gmane.org>,
	"Rafael J. Wysocki" <rjw-KKrjLPT3xs0@public.gmane.org>,
	David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
	Reinette Chatre
	<reinette.chatre-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Kalle Valo <kalle.valo-X3B1VOXEql0@public.gmane.org>,
	David Rientjes <rientjes-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	Mohamed Abbas
	<mohamed.abbas-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Jens Axboe <jens.axboe-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>,
	"John W. Linville"
	<linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>,
	Pekka Enberg <penberg-bbCR+/B0CizivPeTLB3BmA@public.gmane.org>,
	Bartlomiej Zolnierkiewicz
	<bzolnier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Greg Kroah-Hartman <gregkh-l3A5Bk7waGM@public.gmane.org>,
	Stephan von Krawczynski
	<skraw-DcQCyzbjH0jQT0dZR+AlfA@public.gmane.org>,
	Kernel Testers List
	<kernel-testers-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org"
	<linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org>
Subject: Re: [PATCH 4/5] page allocator: Pre-emptively wake kswapd when high-order watermarks are hit
Date: Tue, 27 Oct 2009 15:26:51 +0000	[thread overview]
Message-ID: <20091027152650.GJ8900@csn.ul.ie> (raw)
In-Reply-To: <20091026235032.2F78.A69D9226-+CUm20s59erQFUHtdCDX3A@public.gmane.org>

On Tue, Oct 27, 2009 at 11:42:58AM +0900, KOSAKI Motohiro wrote:
> > When a high-order allocation fails, kswapd is kicked so that it reclaims
> > at a higher-order to avoid direct reclaimers stall and to help GFP_ATOMIC
> > allocations. Something has changed in recent kernels that affect the timing
> > where high-order GFP_ATOMIC allocations are now failing with more frequency,
> > particularly under pressure.
> > 
> > This patch pre-emptively checks if watermarks have been hit after a
> > high-order allocation completes successfully. If the watermarks have been
> > reached, kswapd is woken in the hope it fixes the watermarks before the
> > next GFP_ATOMIC allocation fails.
> > 
> > Warning, this patch is somewhat of a band-aid. If this makes a difference,
> > it still implies that something has changed that is either causing more
> > GFP_ATOMIC allocations to occur (such as the case with iwlagn wireless
> > driver) or make them more likely to fail.
> 
> hmm, I'm confused. this description addressed generic high order allocation.
> but, 
> 
> > 
> > Signed-off-by: Mel Gorman <mel-wPRd99KPJ+uzQB+pC5nmwQ@public.gmane.org>
> > ---
> >  mm/page_alloc.c |   33 ++++++++++++++++++++++-----------
> >  1 files changed, 22 insertions(+), 11 deletions(-)
> > 
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > index 7f2aa3e..851df40 100644
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -1596,6 +1596,17 @@ try_next_zone:
> >  	return page;
> >  }
> >  
> > +static inline
> > +void wake_all_kswapd(unsigned int order, struct zonelist *zonelist,
> > +						enum zone_type high_zoneidx)
> > +{
> > +	struct zoneref *z;
> > +	struct zone *zone;
> > +
> > +	for_each_zone_zonelist(zone, z, zonelist, high_zoneidx)
> > +		wakeup_kswapd(zone, order);
> > +}
> > +
> >  static inline int
> >  should_alloc_retry(gfp_t gfp_mask, unsigned int order,
> >  				unsigned long pages_reclaimed)
> > @@ -1730,18 +1741,18 @@ __alloc_pages_high_priority(gfp_t gfp_mask, unsigned int order,
> 
> __alloc_pages_high_priority() is only called if ALLOC_NO_WATERMARKS.
> ALLOC_NO_WATERMARKS mean PF_MEMALLOC or TIF_MEMDIE and GFP_ATOMIC don't make
> nested alloc_pages() (= don't make PF_MEMALLOC case). 
> Then, I haven't understand why this patch improve iwlagn GFP_ATOMIC case.
> 
> hmm, maybe I missed something. I see the code again tommorow.
> 

The description is misleading but in the patches current form, it makes
a different to Tobias's testing. I still haven't figured out why.

> 
> >  			congestion_wait(BLK_RW_ASYNC, HZ/50);
> >  	} while (!page && (gfp_mask & __GFP_NOFAIL));
> >  
> > -	return page;
> > -}
> > -
> > -static inline
> > -void wake_all_kswapd(unsigned int order, struct zonelist *zonelist,
> > -						enum zone_type high_zoneidx)
> > -{
> > -	struct zoneref *z;
> > -	struct zone *zone;
> > +	/*
> > +	 * If after a high-order allocation we are now below watermarks,
> > +	 * pre-emptively kick kswapd rather than having the next allocation
> > +	 * fail and have to wake up kswapd, potentially failing GFP_ATOMIC
> > +	 * allocations or entering direct reclaim
> > +	 */
> > +	if (unlikely(order) && page && !zone_watermark_ok(preferred_zone, order,
> > +				preferred_zone->watermark[ALLOC_WMARK_LOW],
> > +				zone_idx(preferred_zone), ALLOC_WMARK_LOW))
> > +		wake_all_kswapd(order, zonelist, high_zoneidx);
> >  
> > -	for_each_zone_zonelist(zone, z, zonelist, high_zoneidx)
> > -		wakeup_kswapd(zone, order);
> > +	return page;
> >  }
> >  
> >  static inline int
> > -- 
> > 1.6.3.3
> > 
> > --
> > To unsubscribe, send a message with 'unsubscribe linux-mm' in
> > the body to majordomo-Bw31MaZKKs0EbZ0PF+XxCw@public.gmane.org  For more info on Linux MM,
> > see: http://www.linux-mm.org/ .
> > Don't email: <a href=mailto:"dont-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org"> email-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org </a>
> 
> 
> 

-- 
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

  parent reply	other threads:[~2009-10-27 15:26 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-22 14:22 [PATCH 0/5] Candidate fix for increased number of GFP_ATOMIC failures V2 Mel Gorman
     [not found] ` <1256221356-26049-1-git-send-email-mel-wPRd99KPJ+uzQB+pC5nmwQ@public.gmane.org>
2009-10-22 14:22   ` [PATCH 1/5] page allocator: Always wake kswapd when restarting an allocation attempt after direct reclaim failed Mel Gorman
2009-10-22 14:24     ` [PATCH 1/5 Against 2.6.31.4] " Mel Gorman
2009-10-22 14:41     ` [PATCH 1/5] " Pekka Enberg
2009-10-22 15:49       ` Mel Gorman
     [not found]     ` <1256221356-26049-2-git-send-email-mel-wPRd99KPJ+uzQB+pC5nmwQ@public.gmane.org>
2009-10-26  1:11       ` KOSAKI Motohiro
2009-10-26  7:10         ` David Rientjes
2009-10-27  2:42           ` KOSAKI Motohiro
2009-10-27 12:27             ` Mel Gorman
2009-10-22 14:22   ` [PATCH 2/5] page allocator: Do not allow interrupts to use ALLOC_HARDER Mel Gorman
2009-10-22 16:33     ` Stephan von Krawczynski
     [not found]       ` <20091022183303.2448942d.skraw-DcQCyzbjH0jQT0dZR+AlfA@public.gmane.org>
2009-10-22 16:37         ` Mel Gorman
     [not found]           ` <20091022163752.GU11778-wPRd99KPJ+uzQB+pC5nmwQ@public.gmane.org>
2009-10-23  9:57             ` Stephan von Krawczynski
2009-10-24  2:03           ` Christoph Lameter
2009-10-27 15:19             ` Mel Gorman
2009-10-25 12:57           ` Stephan von Krawczynski
2009-10-26  1:15     ` KOSAKI Motohiro
2009-10-24 13:51   ` [PATCH 0/5] Candidate fix for increased number of GFP_ATOMIC failures V2 Frans Pop
2009-10-26 17:37   ` Tobias Oetiker
2009-10-27 15:36     ` Mel Gorman
2009-10-22 14:22 ` [PATCH 3/5] vmscan: Force kswapd to take notice faster when high-order watermarks are being hit Mel Gorman
2009-10-27  2:42   ` KOSAKI Motohiro
2009-10-22 14:22 ` [PATCH 4/5] page allocator: Pre-emptively wake kswapd when high-order watermarks are hit Mel Gorman
     [not found]   ` <1256221356-26049-5-git-send-email-mel-wPRd99KPJ+uzQB+pC5nmwQ@public.gmane.org>
2009-10-22 19:41     ` David Rientjes
     [not found]       ` <alpine.DEB.2.00.0910221227010.21601-X6Q0R45D7oAcqpCFd4KODRPsWskHk0ljAL8bYrjMMd8@public.gmane.org>
2009-10-23  9:13         ` Mel Gorman
2009-10-23  9:36           ` David Rientjes
     [not found]             ` <alpine.DEB.2.00.0910230229010.28109-X6Q0R45D7oAcqpCFd4KODRPsWskHk0ljAL8bYrjMMd8@public.gmane.org>
2009-10-23 11:25               ` Mel Gorman
2009-10-23 11:31                 ` Tobias Oetiker
     [not found]                   ` <alpine.DEB.2.00.0910231329550.26462-EjsAmf5DE5zIvOfxy3zmAzgUDZmNtoG9@public.gmane.org>
2009-10-23 13:39                     ` Mel Gorman
2009-10-27  2:42   ` KOSAKI Motohiro
     [not found]     ` <20091026235032.2F78.A69D9226-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2009-10-27 15:26       ` Mel Gorman [this message]
2009-10-22 14:22 ` [PATCH 5/5] ONLY-APPLY-IF-STILL-FAILING Revert 373c0a7e, 8aa7e847: Fix congestion_wait() sync/async vs read/write confusion Mel Gorman
2009-10-22 14:25   ` Against 2.6.31.4 [PATCH 5/5] " Mel Gorman
2009-10-22 21:49   ` [PATCH 5/5] ONLY-APPLY-IF-STILL-FAILING " Jens Axboe
2009-10-27  2:42   ` KOSAKI Motohiro
2009-10-27 10:29     ` Frans Pop
2009-10-22 14:47 ` [PATCH 0/5] Candidate fix for increased number of GFP_ATOMIC failures V2 Pekka Enberg
     [not found]   ` <84144f020910220747nba30d8bkc83c2569da79bd7c-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-10-22 16:03     ` Mel Gorman
2009-10-24  1:52   ` Christoph Lameter
2009-10-24  6:48     ` Pekka Enberg
2009-10-22 15:43 ` reinette chatre
2009-10-27 10:40   ` Mel Gorman
2009-10-27 23:34     ` reinette chatre
2009-10-23  7:31 ` Sven Geggus
2009-10-23 16:58 ` Karol Lewandowski
2009-10-23 21:12   ` Karol Lewandowski
2009-10-24 13:46     ` Mel LKML
     [not found]       ` <9ec2d7290910240646p75b93c68v6ea1648d628a9660-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-10-28 11:42         ` Karol Lewandowski
     [not found]           ` <20091028114208.GA14476-nLtalAL5mPp2RxbNQum0x1nzlInOXLuq@public.gmane.org>
2009-10-28 11:59             ` Mel Gorman
     [not found]               ` <20091028115926.GW8900-wPRd99KPJ+uzQB+pC5nmwQ@public.gmane.org>
2009-10-30 14:23                 ` Karol Lewandowski
     [not found]                   ` <20091030142350.GA9343-nLtalAL5mPp2RxbNQum0x1nzlInOXLuq@public.gmane.org>
2009-11-02 20:30                     ` Mel Gorman
     [not found]                       ` <20091102203034.GC22046-wPRd99KPJ+uzQB+pC5nmwQ@public.gmane.org>
2009-11-04  2:03                         ` Karol Lewandowski
2009-10-28 12:55             ` Tobi Oetiker
2009-10-24 14:02 ` Sven Geggus
2009-10-27 13:27   ` Mel Gorman
2009-10-26 22:17 ` Frans Pop
2009-10-26 23:45   ` Frans Pop
2009-11-06  6:03 ` Tobias Diedrich
2009-11-06  9:24   ` Mel Gorman
     [not found]   ` <20091106092447.GC25926@csn.ul.ie>
2009-11-06 11:15     ` Tobias Diedrich

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=20091027152650.GJ8900@csn.ul.ie \
    --to=mel-wprd99kpj+uzqb+pc5nmwq@public.gmane.org \
    --cc=bzolnier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=elendil-EIBgga6/0yRmR6Xm/wNWPw@public.gmane.org \
    --cc=gregkh-l3A5Bk7waGM@public.gmane.org \
    --cc=jens.axboe-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
    --cc=jkosina-AlSwsSmVLrQ@public.gmane.org \
    --cc=kalle.valo-X3B1VOXEql0@public.gmane.org \
    --cc=karol.k.lewandowski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=kernel-testers-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=kosaki.motohiro-+CUm20s59erQFUHtdCDX3A@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
    --cc=linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org \
    --cc=lists-+AJD3D7QEjjt/htJsj1pd9AswbaBtrod@public.gmane.org \
    --cc=mohamed.abbas-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=penberg-bbCR+/B0CizivPeTLB3BmA@public.gmane.org \
    --cc=reinette.chatre-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=rientjes-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=rjw-KKrjLPT3xs0@public.gmane.org \
    --cc=skraw-DcQCyzbjH0jQT0dZR+AlfA@public.gmane.org \
    --cc=tobi-7K0TWYW2a3pyDzI6CaY1VQ@public.gmane.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;
as well as URLs for NNTP newsgroup(s).