linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Rik van Riel <riel@redhat.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: Linux kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-mm@kvack.org, akpm@linux-foundation.org,
	safari-kernel@safari.iki.fi
Subject: Re: [PATCH] prevent kswapd from freeing excessive amounts of lowmem
Date: Sat, 08 Sep 2007 16:20:33 -0400	[thread overview]
Message-ID: <46E30411.3070500@redhat.com> (raw)
In-Reply-To: <20070907122437.GC3901@ucw.cz>

Pavel Machek wrote:
> Hi!
> 
>> The current VM can get itself into trouble fairly easily 
>> on systems
>> with a small ZONE_HIGHMEM, which is common on i686 
>> computers with
>> 1GB of memory.
>>
>> On one side, page_alloc() will allocate down to 
>> zone->pages_low,
>> while on the other side, kswapd() and balance_pgdat() 
>> will try
>> to free memory from every zone, until every zone has 
>> more free
>> pages than zone->pages_high.
>>
>> Highmem can be filled up to zone->pages_low with page 
>> tables,
>> ramfs, vmalloc allocations and other unswappable things 
>> quite
>> easily and without many bad side effects, since we still 
>> have
>> a huge ZONE_NORMAL to do future allocations from.
>>
>> However, as long as the number of free pages in the 
>> highmem
>> zone is below zone->pages_high, kswapd will continue 
>> swapping
>> things out from ZONE_NORMAL, too!
>>
>> Sami Farin managed to get his system into a stage where 
>> kswapd
>> had freed about 700MB of low memory and was still "going 
>> strong".
>>
>> The attached patch will make kswapd stop paging out data 
>> from
>> zones when there is more than enough memory free.  We do 
>> go above
>> zone->pages_high in order to keep pressure between zones 
>> equal
>> in normal circumstances, but the patch should prevent 
>> the kind
>> of excesses that made Sami's computer totally unusable.
>>
>> Please merge this into -mm.
>>
>> Signed-off-by: Rik van Riel <riel@redhat.com>
> 
>> --- linux-2.6.22.noarch/mm/vmscan.c.excessive	2007-09-05 12:19:49.000000000 -0400
>> +++ linux-2.6.22.noarch/mm/vmscan.c	2007-09-05 12:21:40.000000000 -0400
>> @@ -1371,7 +1371,13 @@ loop_again:
>>  			temp_priority[i] = priority;
>>  			sc.nr_scanned = 0;
>>  			note_zone_scanning_priority(zone, priority);
>> -			nr_reclaimed += shrink_zone(priority, zone, &sc);
>> +			/*
>> +			 * We put equal pressure on every zone, unless one
>> +			 * zone has way too many pages free already.
>> +			 */
> 
> That does not seem right. Having empty HIGHMEM and full LOWMEM would
> be very bad, right? We may stop freeing when there's enough LOWMEM
> free, but not if there's only HIGHMEM free.

Please read the code this patch applies to.

The check I add conditionalizes the individual
calls to shrink_zone(), so we do not call
shrink_zone() for a zone that has a ton of free
pages.  We still call shrink_zone() for the
other zones.

-- 
Politics is the struggle between those who want to make their country
the best in the world, and those who believe it already is.  Each group
calls the other unpatriotic.

--
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:[~2007-09-08 20:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-05 23:01 Rik van Riel
2007-09-06  1:23 ` Andrew Morton
2007-09-06 16:38   ` Rik van Riel
2007-09-06 22:34     ` Andrew Morton
2007-09-06 22:47       ` Rik van Riel
2007-09-07 12:24 ` Pavel Machek
2007-09-08 20:20   ` Rik van Riel [this message]

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=46E30411.3070500@redhat.com \
    --to=riel@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pavel@ucw.cz \
    --cc=safari-kernel@safari.iki.fi \
    /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