All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shaohua Li <shaohua.li@intel.com>
To: Mel Gorman <mel@csn.ul.ie>
Cc: Simon Kirby <sim@hostway.ca>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Dave Hansen <dave@linux.vnet.ibm.com>
Subject: Re: Free memory never fully used, swapping
Date: Fri, 26 Nov 2010 10:05:40 +0800	[thread overview]
Message-ID: <1290737140.12777.13.camel@sli10-conroe> (raw)
In-Reply-To: <20101126012527.GI26037@csn.ul.ie>

On Fri, 2010-11-26 at 09:25 +0800, Mel Gorman wrote:
> On Fri, Nov 26, 2010 at 09:05:56AM +0800, Shaohua Li wrote:
> > > @@ -2168,6 +2180,7 @@ static int sleeping_prematurely(pg_data_t *pgdat, int order, long remaining)
> > >  static unsigned long balance_pgdat(pg_data_t *pgdat, int order)
> > >  {
> > >         int all_zones_ok;
> > > +       int any_zone_ok;
> > >         int priority;
> > >         int i;
> > >         unsigned long total_scanned;
> > > @@ -2201,6 +2214,7 @@ loop_again:
> > >                         disable_swap_token();
> > > 
> > >                 all_zones_ok = 1;
> > > +               any_zone_ok = 0;
> > > 
> > >                 /*
> > >                  * Scan in the highmem->dma direction for the highest
> > > @@ -2310,10 +2324,12 @@ loop_again:
> > >                                  * spectulatively avoid congestion waits
> > >                                  */
> > >                                 zone_clear_flag(zone, ZONE_CONGESTED);
> > > +                               if (i <= pgdat->high_zoneidx)
> > > +                                       any_zone_ok = 1;
> > >                         }
> > > 
> > >                 }
> > > -               if (all_zones_ok)
> > > +               if (all_zones_ok || (order && any_zone_ok))
> > >                         break;          /* kswapd: all done */
> > >                 /*
> > >                  * OK, kswapd is getting into trouble.  Take a nap, then take
> > > @@ -2336,7 +2352,7 @@ loop_again:
> > >                         break;
> > >         }
> > >  out:
> > > -       if (!all_zones_ok) {
> > > +       if (!(all_zones_ok || (order && any_zone_ok))) {
> > >                 cond_resched();
> > > 
> > >                 try_to_freeze();
> > > @@ -2361,7 +2377,13 @@ out:
> > >                 goto loop_again;
> > >         }
> > > 
> > > -       return sc.nr_reclaimed;
> > > +       /*
> > > +        * Return the order we were reclaiming at so sleeping_prematurely()
> > > +        * makes a decision on the order we were last reclaiming at. However,
> > > +        * if another caller entered the allocator slow path while kswapd
> > > +        * was awake, order will remain at the higher level
> > > +        */
> > > +       return order;
> > >  }
> > This seems always fail. because you have the protect in the kswapd side,
> > but no in the page allocation side. so every time a high order
> > allocation occurs, the protect breaks and kswapd keeps running.
> > 
> 
> I don't understand your question. sc.nr_reclaimed was being unused. The
> point of returning order was to tell kswapd that "the order you were
> reclaiming at may or may not be still valid, make your decisions on the
> order I am currently reclaiming at". The key here is if that multiple
> allocation requests come in for higher orders, kswapd will get reworken
> multiple times. Unless it gets rewoken multiple times, kswapd is willing
> to go back to sleep to avoid reclaiming an excessive number of pages.
yes, I thought is rewoken multiple times, in the workload Simon reported
Node 0, zone    DMA32  20741  29383   6022    134    272   123 4 0 0 0 0
Node 0, zone   Normal    453      1      0      0      0     0 0 0 0 0 0
Node 0, zone    DMA32  20476  29370   6024    117     48   116 4 0 0 0 0
Node 0, zone   Normal    453      1      0      0      0     0 0 0 0 0 0
Node 0, zone    DMA32  20343  29369   6020    110     23    10 2 0 0 0 0
Node 0, zone   Normal    453      1      0      0      0     0 0 0 0 0 0
Node 0, zone    DMA32  21592  30477   4856     22     10     4 2 0 0 0 0
order >=3 pages are reduced a lot in a second


WARNING: multiple messages have this Message-ID (diff)
From: Shaohua Li <shaohua.li@intel.com>
To: Mel Gorman <mel@csn.ul.ie>
Cc: Simon Kirby <sim@hostway.ca>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Dave Hansen <dave@linux.vnet.ibm.com>
Subject: Re: Free memory never fully used, swapping
Date: Fri, 26 Nov 2010 10:05:40 +0800	[thread overview]
Message-ID: <1290737140.12777.13.camel@sli10-conroe> (raw)
In-Reply-To: <20101126012527.GI26037@csn.ul.ie>

On Fri, 2010-11-26 at 09:25 +0800, Mel Gorman wrote:
> On Fri, Nov 26, 2010 at 09:05:56AM +0800, Shaohua Li wrote:
> > > @@ -2168,6 +2180,7 @@ static int sleeping_prematurely(pg_data_t *pgdat, int order, long remaining)
> > >  static unsigned long balance_pgdat(pg_data_t *pgdat, int order)
> > >  {
> > >         int all_zones_ok;
> > > +       int any_zone_ok;
> > >         int priority;
> > >         int i;
> > >         unsigned long total_scanned;
> > > @@ -2201,6 +2214,7 @@ loop_again:
> > >                         disable_swap_token();
> > > 
> > >                 all_zones_ok = 1;
> > > +               any_zone_ok = 0;
> > > 
> > >                 /*
> > >                  * Scan in the highmem->dma direction for the highest
> > > @@ -2310,10 +2324,12 @@ loop_again:
> > >                                  * spectulatively avoid congestion waits
> > >                                  */
> > >                                 zone_clear_flag(zone, ZONE_CONGESTED);
> > > +                               if (i <= pgdat->high_zoneidx)
> > > +                                       any_zone_ok = 1;
> > >                         }
> > > 
> > >                 }
> > > -               if (all_zones_ok)
> > > +               if (all_zones_ok || (order && any_zone_ok))
> > >                         break;          /* kswapd: all done */
> > >                 /*
> > >                  * OK, kswapd is getting into trouble.  Take a nap, then take
> > > @@ -2336,7 +2352,7 @@ loop_again:
> > >                         break;
> > >         }
> > >  out:
> > > -       if (!all_zones_ok) {
> > > +       if (!(all_zones_ok || (order && any_zone_ok))) {
> > >                 cond_resched();
> > > 
> > >                 try_to_freeze();
> > > @@ -2361,7 +2377,13 @@ out:
> > >                 goto loop_again;
> > >         }
> > > 
> > > -       return sc.nr_reclaimed;
> > > +       /*
> > > +        * Return the order we were reclaiming at so sleeping_prematurely()
> > > +        * makes a decision on the order we were last reclaiming at. However,
> > > +        * if another caller entered the allocator slow path while kswapd
> > > +        * was awake, order will remain at the higher level
> > > +        */
> > > +       return order;
> > >  }
> > This seems always fail. because you have the protect in the kswapd side,
> > but no in the page allocation side. so every time a high order
> > allocation occurs, the protect breaks and kswapd keeps running.
> > 
> 
> I don't understand your question. sc.nr_reclaimed was being unused. The
> point of returning order was to tell kswapd that "the order you were
> reclaiming at may or may not be still valid, make your decisions on the
> order I am currently reclaiming at". The key here is if that multiple
> allocation requests come in for higher orders, kswapd will get reworken
> multiple times. Unless it gets rewoken multiple times, kswapd is willing
> to go back to sleep to avoid reclaiming an excessive number of pages.
yes, I thought is rewoken multiple times, in the workload Simon reported
Node 0, zone    DMA32  20741  29383   6022    134    272   123 4 0 0 0 0
Node 0, zone   Normal    453      1      0      0      0     0 0 0 0 0 0
Node 0, zone    DMA32  20476  29370   6024    117     48   116 4 0 0 0 0
Node 0, zone   Normal    453      1      0      0      0     0 0 0 0 0 0
Node 0, zone    DMA32  20343  29369   6020    110     23    10 2 0 0 0 0
Node 0, zone   Normal    453      1      0      0      0     0 0 0 0 0 0
Node 0, zone    DMA32  21592  30477   4856     22     10     4 2 0 0 0 0
order >=3 pages are reduced a lot in a second

--
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/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2010-11-26  2:05 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-15 19:52 Free memory never fully used, swapping Simon Kirby
2010-11-22 23:44 ` Andrew Morton
2010-11-22 23:44   ` Andrew Morton
2010-11-23  1:34   ` Simon Kirby
2010-11-23  1:34     ` Simon Kirby
2010-11-23  8:35   ` Dave Hansen
2010-11-23  8:35     ` Dave Hansen
2010-11-24  8:46     ` Simon Kirby
2010-11-24  8:46       ` Simon Kirby
2010-11-25  1:07       ` Shaohua Li
2010-11-25  1:07         ` Shaohua Li
2010-11-25  9:03         ` Simon Kirby
2010-11-25  9:03           ` Simon Kirby
2010-11-25 10:18           ` KOSAKI Motohiro
2010-11-25 10:18             ` KOSAKI Motohiro
2010-11-25 17:13             ` Simon Kirby
2010-11-25 17:13               ` Simon Kirby
2010-11-26  0:33               ` KOSAKI Motohiro
2010-11-26  0:33                 ` KOSAKI Motohiro
2010-11-25 10:51           ` KOSAKI Motohiro
2010-11-25 10:51             ` KOSAKI Motohiro
2010-11-25 16:15             ` Mel Gorman
2010-11-25 16:15               ` Mel Gorman
2010-11-26  2:00               ` Shaohua Li
2010-11-26  2:00                 ` Shaohua Li
2010-11-26  2:31                 ` KOSAKI Motohiro
2010-11-26  2:31                   ` KOSAKI Motohiro
2010-11-26  2:40                   ` Shaohua Li
2010-11-26  2:40                     ` Shaohua Li
2010-11-26  9:18                     ` KOSAKI Motohiro
2010-11-26  9:18                       ` KOSAKI Motohiro
2010-11-29  1:03                       ` Shaohua Li
2010-11-29  1:03                         ` Shaohua Li
2010-11-29  1:13                         ` KOSAKI Motohiro
2010-11-29  1:13                           ` KOSAKI Motohiro
2010-11-26  0:07             ` KOSAKI Motohiro
2010-11-26  0:07               ` KOSAKI Motohiro
2010-11-25 16:12           ` Mel Gorman
2010-11-25 16:12             ` Mel Gorman
2010-11-26  1:05             ` Shaohua Li
2010-11-26  1:05               ` Shaohua Li
2010-11-26  1:25               ` Mel Gorman
2010-11-26  1:25                 ` Mel Gorman
2010-11-26  2:05                 ` Shaohua Li [this message]
2010-11-26  2:05                   ` Shaohua Li
2010-11-26 11:03             ` KOSAKI Motohiro
2010-11-26 11:03               ` KOSAKI Motohiro
2010-11-26 11:11               ` Mel Gorman
2010-11-26 11:11                 ` Mel Gorman
2010-11-30  6:31                 ` KOSAKI Motohiro
2010-11-30  6:31                   ` KOSAKI Motohiro
2010-11-30 10:41                   ` Mel Gorman
2010-11-30 10:41                     ` Mel Gorman
2010-11-30 11:19                     ` KOSAKI Motohiro
2010-11-30 11:19                       ` KOSAKI Motohiro
2010-11-30  8:22             ` Simon Kirby
2010-11-30  8:22               ` Simon Kirby
2010-11-29  9:31       ` KOSAKI Motohiro
2010-11-29  9:31         ` KOSAKI Motohiro
2010-11-23 10:04   ` Mel Gorman
2010-11-23 10:04     ` Mel Gorman
2010-11-24  6:43     ` Simon Kirby
2010-11-24  6:43       ` Simon Kirby
2010-11-24  9:27       ` Mel Gorman
2010-11-24  9:27         ` Mel Gorman
2010-11-24 19:17         ` Simon Kirby
2010-11-24 19:17           ` Simon Kirby
2010-11-25  1:18           ` KOSAKI Motohiro
2010-11-25  1:18             ` KOSAKI Motohiro
2010-11-26 15:48             ` Christoph Lameter
2010-11-26 15:48               ` Christoph Lameter
2010-11-30  0:25               ` KOSAKI Motohiro
2010-11-30  0:25                 ` KOSAKI Motohiro
2010-11-30 19:10                 ` Christoph Lameter
2010-11-30 19:10                   ` Christoph Lameter
2010-12-01 10:17                   ` KOSAKI Motohiro
2010-12-01 10:17                     ` KOSAKI Motohiro
2010-12-01 15:29                     ` Christoph Lameter
2010-12-01 15:29                       ` Christoph Lameter
2010-12-02  2:44                       ` KOSAKI Motohiro
2010-12-02  2:44                         ` KOSAKI Motohiro
2010-12-02 14:39                         ` Christoph Lameter
2010-12-02 14:39                           ` Christoph Lameter
2010-11-30  9:13               ` Simon Kirby
2010-11-30  9:13                 ` Simon Kirby
2010-11-30 19:13                 ` Christoph Lameter
2010-11-30 19:13                   ` Christoph Lameter

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=1290737140.12777.13.camel@sli10-conroe \
    --to=shaohua.li@intel.com \
    --cc=dave@linux.vnet.ibm.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mel@csn.ul.ie \
    --cc=sim@hostway.ca \
    /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.