* Free memory starvation in a zone?
@ 2001-08-03 17:25 Jeremy Linton
2001-08-03 22:29 ` Marcelo Tosatti
0 siblings, 1 reply; 6+ messages in thread
From: Jeremy Linton @ 2001-08-03 17:25 UTC (permalink / raw)
To: linux-kernel
In kreclaimd() there is a nice loop that looks like
for(i = 0; i < MAX_NR_ZONES; i++) {
zone_t *zone = pgdat->node_zones + i;
if (!zone->size)
continue;
while (zone->free_pages < zone->pages_low) {
struct page * page;
page = reclaim_page(zone);
if (!page)
break;
__free_page(page);
}
}
I was playing around with the page age algorithm when i noticed that it
appears that the machine will get into a state where the inner loop _NEVER_
exits the current zone because applications running in that zone are eating
the memory as fast as it is being freed up. I imaging that this could be
causing some pretty serious problems since the other zone's pages will only
get recleaimed during a page alloc. Maybe there should be a max number of
pages that can be reclaimed out of any given zone to force this loop to
break? Something like 5 or 10% of the zone?
Any comments?
BTW: I started playing with the page age system when I noticed that it
wasn't very evenly distributed. All the pages in a tend to fall into one or
two age groups pretty close to PAGE_AGE_START with a significant number of
them often below PAGE_AGE_START.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Free memory starvation in a zone?
2001-08-03 17:25 Free memory starvation in a zone? Jeremy Linton
@ 2001-08-03 22:29 ` Marcelo Tosatti
2001-08-04 5:34 ` Mike Galbraith
0 siblings, 1 reply; 6+ messages in thread
From: Marcelo Tosatti @ 2001-08-03 22:29 UTC (permalink / raw)
To: Jeremy Linton; +Cc: linux-kernel
On Fri, 3 Aug 2001, Jeremy Linton wrote:
> In kreclaimd() there is a nice loop that looks like
>
> for(i = 0; i < MAX_NR_ZONES; i++) {
> zone_t *zone = pgdat->node_zones + i;
> if (!zone->size)
> continue;
>
> while (zone->free_pages < zone->pages_low) {
> struct page * page;
> page = reclaim_page(zone);
> if (!page)
> break;
> __free_page(page);
> }
> }
>
> I was playing around with the page age algorithm when i noticed that it
> appears that the machine will get into a state where the inner loop _NEVER_
> exits the current zone because applications running in that zone are eating
> the memory as fast as it is being freed up.
Normal allocations are going to block giving a chance for kreclaimd to run
(and remember, the loop and the freeing routines are really fast).
Are you sure you're seeing kreclaimd looping too much here ?
I've never seen that, and if I did I would get really really
concerned: we rely on kreclaimd to avoid atomic allocations from failing
in a fragile way.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Free memory starvation in a zone?
2001-08-04 5:34 ` Mike Galbraith
@ 2001-08-04 4:13 ` Marcelo Tosatti
2001-08-04 5:43 ` Rik van Riel
1 sibling, 0 replies; 6+ messages in thread
From: Marcelo Tosatti @ 2001-08-04 4:13 UTC (permalink / raw)
To: Mike Galbraith; +Cc: Jeremy Linton, linux-kernel
On Sat, 4 Aug 2001, Mike Galbraith wrote:
> On Fri, 3 Aug 2001, Marcelo Tosatti wrote:
>
> > On Fri, 3 Aug 2001, Jeremy Linton wrote:
> >
> > > In kreclaimd() there is a nice loop that looks like
> > >
> > > for(i = 0; i < MAX_NR_ZONES; i++) {
> > > zone_t *zone = pgdat->node_zones + i;
> > > if (!zone->size)
> > > continue;
> > >
> > > while (zone->free_pages < zone->pages_low) {
> > > struct page * page;
> > > page = reclaim_page(zone);
> > > if (!page)
> > > break;
> > > __free_page(page);
> > > }
> > > }
> > >
> > > I was playing around with the page age algorithm when i noticed that it
> > > appears that the machine will get into a state where the inner loop _NEVER_
> > > exits the current zone because applications running in that zone are eating
> > > the memory as fast as it is being freed up.
> >
> > Normal allocations are going to block giving a chance for kreclaimd to run
> > (and remember, the loop and the freeing routines are really fast).
> >
> > Are you sure you're seeing kreclaimd looping too much here ?
> >
> > I've never seen that, and if I did I would get really really
> > concerned: we rely on kreclaimd to avoid atomic allocations from failing
> > in a fragile way.
>
> Snippet from one of Dirk's logs.
>
> PID PPID USER PRI SIZE SWAP RSS SHARE D STAT %CPU %MEM TIME COMMA
> 3 1 root 20 0 0 0 0 0 RW 58.8 0.0 2:41 kswapd
> 1494 1421 novatest 15 2009M 640M 1.3G 51476 0M R N 40.8 34.5 6:26 ceqsim
> 1751 1747 root 14 1048 4 1044 824 55 R 28.0 0.0 0:02 top
> 4 1 root 14 0 0 0 0 0 SW 27.1 0.0 1:06 krecla
The problem is if we have kreclaimd not able to satisfy all zones needs.
CPU usage does not mean zone freemem starvation.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Free memory starvation in a zone?
2001-08-03 22:29 ` Marcelo Tosatti
@ 2001-08-04 5:34 ` Mike Galbraith
2001-08-04 4:13 ` Marcelo Tosatti
2001-08-04 5:43 ` Rik van Riel
0 siblings, 2 replies; 6+ messages in thread
From: Mike Galbraith @ 2001-08-04 5:34 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: Jeremy Linton, linux-kernel
On Fri, 3 Aug 2001, Marcelo Tosatti wrote:
> On Fri, 3 Aug 2001, Jeremy Linton wrote:
>
> > In kreclaimd() there is a nice loop that looks like
> >
> > for(i = 0; i < MAX_NR_ZONES; i++) {
> > zone_t *zone = pgdat->node_zones + i;
> > if (!zone->size)
> > continue;
> >
> > while (zone->free_pages < zone->pages_low) {
> > struct page * page;
> > page = reclaim_page(zone);
> > if (!page)
> > break;
> > __free_page(page);
> > }
> > }
> >
> > I was playing around with the page age algorithm when i noticed that it
> > appears that the machine will get into a state where the inner loop _NEVER_
> > exits the current zone because applications running in that zone are eating
> > the memory as fast as it is being freed up.
>
> Normal allocations are going to block giving a chance for kreclaimd to run
> (and remember, the loop and the freeing routines are really fast).
>
> Are you sure you're seeing kreclaimd looping too much here ?
>
> I've never seen that, and if I did I would get really really
> concerned: we rely on kreclaimd to avoid atomic allocations from failing
> in a fragile way.
Snippet from one of Dirk's logs.
PID PPID USER PRI SIZE SWAP RSS SHARE D STAT %CPU %MEM TIME COMMA
3 1 root 20 0 0 0 0 0 RW 58.8 0.0 2:41 kswapd
1494 1421 novatest 15 2009M 640M 1.3G 51476 0M R N 40.8 34.5 6:26 ceqsim
1751 1747 root 14 1048 4 1044 824 55 R 28.0 0.0 0:02 top
4 1 root 14 0 0 0 0 0 SW 27.1 0.0 1:06 krecla
-Mike
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Free memory starvation in a zone?
2001-08-04 5:34 ` Mike Galbraith
2001-08-04 4:13 ` Marcelo Tosatti
@ 2001-08-04 5:43 ` Rik van Riel
2001-08-04 6:02 ` Mike Galbraith
1 sibling, 1 reply; 6+ messages in thread
From: Rik van Riel @ 2001-08-04 5:43 UTC (permalink / raw)
To: Mike Galbraith; +Cc: Marcelo Tosatti, Jeremy Linton, linux-kernel
On Sat, 4 Aug 2001, Mike Galbraith wrote:
> > Are you sure you're seeing kreclaimd looping too much here ?
>
> Snippet from one of Dirk's logs.
>
> PID PPID USER PRI SIZE SWAP RSS SHARE D STAT %CPU %MEM TIME COMMA
> 3 1 root 20 0 0 0 0 0 RW 58.8 0.0 2:41 kswapd
> 1494 1421 novatest 15 2009M 640M 1.3G 51476 0M R N 40.8 34.5 6:26 ceqsim
> 1751 1747 root 14 1048 4 1044 824 55 R 28.0 0.0 0:02 top
> 4 1 root 14 0 0 0 0 0 SW 27.1 0.0 1:06 krecla
I'm pretty sure this is because kreclaimd is woken up from
__alloc_pages() all the time and cannot find anything useful
to do ...
regards,
Rik
--
Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...
http://www.surriel.com/ http://distro.conectiva.com/
Send all your spam to aardvark@nl.linux.org (spam digging piggy)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Free memory starvation in a zone?
2001-08-04 5:43 ` Rik van Riel
@ 2001-08-04 6:02 ` Mike Galbraith
0 siblings, 0 replies; 6+ messages in thread
From: Mike Galbraith @ 2001-08-04 6:02 UTC (permalink / raw)
To: Rik van Riel; +Cc: Marcelo Tosatti, Jeremy Linton, linux-kernel
On Sat, 4 Aug 2001, Rik van Riel wrote:
> On Sat, 4 Aug 2001, Mike Galbraith wrote:
>
> > > Are you sure you're seeing kreclaimd looping too much here ?
> >
> > Snippet from one of Dirk's logs.
> >
> > PID PPID USER PRI SIZE SWAP RSS SHARE D STAT %CPU %MEM TIME COMMA
> > 3 1 root 20 0 0 0 0 0 RW 58.8 0.0 2:41 kswapd
> > 1494 1421 novatest 15 2009M 640M 1.3G 51476 0M R N 40.8 34.5 6:26 ceqsim
> > 1751 1747 root 14 1048 4 1044 824 55 R 28.0 0.0 0:02 top
> > 4 1 root 14 0 0 0 0 0 SW 27.1 0.0 1:06 krecla
>
> I'm pretty sure this is because kreclaimd is woken up from
> __alloc_pages() all the time and cannot find anything useful
> to do ...
Yes, it could be bouncing (eg) referenced pages instead of looping.
In any case though, seems it would it be better to take locks, evaluate
once and free in batch. With the possibility to bounce off of locks,
it does look like looping is possible (if unlikely). Just picking a
quantity and freeing it instead of reevaluating constantly would close
off that possibility without batch freeing.
-Mike
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2001-08-04 6:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-08-03 17:25 Free memory starvation in a zone? Jeremy Linton
2001-08-03 22:29 ` Marcelo Tosatti
2001-08-04 5:34 ` Mike Galbraith
2001-08-04 4:13 ` Marcelo Tosatti
2001-08-04 5:43 ` Rik van Riel
2001-08-04 6:02 ` Mike Galbraith
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox