From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Andrew Morton <akpm@osdl.org>,
Linux Memory Management <linux-mm@kvack.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [RFC][PATCH 0/3] beat kswapd with the proverbial clue-bat
Date: Mon, 06 Sep 2004 10:54:51 +1000 [thread overview]
Message-ID: <413BB55B.9000106@yahoo.com.au> (raw)
In-Reply-To: <Pine.LNX.4.58.0409050911450.2331@ppc970.osdl.org>
Linus Torvalds wrote:
>
>On Sun, 5 Sep 2004, Nick Piggin wrote:
>
>>So my solution? Just teach kswapd and the watermark code about higher
>>order allocations in a fairly simple way. If pages_low is (say), 1024KB,
>>we now also require 512KB of order-1 and above pages, 256K of order-2
>>and up, 128K of order 3, etc. (perhaps we should stop at about order-3?)
>>
>
>I'm pretty sure we did something like this (where we not only required a
>certain amount of memory free, but also a certain buddy availability) for
>a short while in the 2.3.x timeframe or something like that, and that it
>caused problems for some machines that just kept on trying to free memory.
>
>
OK. As I explained in a follow up, my paragraph you quoted was a bit
confused. We don't try to keep any higher order allocations free by
checking the watermarks unless we're trying to make an allocation of
that order in the first place.
So if order 0 allocations are the only thing that ever get done, then
everything proceeds as before. If we do an order 1 allocation, we'll
only kick kswapd if we're low on memory that can satisfy order 1 allocs.
So it is only ever going to free pages when they really are being requested.
Also, if the required memory just can't be freed, kswapd will give up and
forget about it (ie. kswapd_max_order = 0;)
>I wrote a program at the time to check why, but I've long since lost it,
>so I re-created it just now (probably buggy as hell), and append it here
>for you to debug the dang thing.
>
>In it's first rough draft (ie "it might be totally wrong") using this
>script:
>
>
It looks correct to me. It does give a good argument for defragmentation.
But that is a bit orthogonal to what my patches do: they make kswapd work
properly to free higher order memory. The current alternatives are to do
the exact same work (lots of scanning) in allocator context, or fail the
allocation.
If someone wants to make that work, "lots of scanning" into "a bit of
defragmenting", great.
>
>Now, this test-result is not "real life", in that the whole point of the
>buddy allocator is that it is good at trying to keep higher orders free,
>and as such real life should behave much better. But this _is_ pretty
>accurate for the case where we totally ran out of memory and are trying
>to randomly free one page here and one page there. That's where buddy
>doesn't much help us, so this kind of shows the worst case.
>
>(Rule: you should not allow the machine to get to this point, exactly
>because at the < ~5% free point, buddy stops being very effective).
>
>Notice how you may need to free 20% of memory to get a 2**3 allocation, if
>you have totally depleted your pages. And it's much worse if you have very
>little memory to begin with.
>
>Anyway. I haven't debugged this program, so it may have serious bugs, and
>be off by an order of magnitude or two. Whatever. If I'm wrong, somebody
>can fix the program/script and see what the real numbers are.
>
>
No, Andrew just recently reported that order-1 allocations were needing to
free 20MB or more (on systems with not really huge memories IIRC). So I
think your program could be reasonably close to real life.
--
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:"aart@kvack.org"> aart@kvack.org </a>
next prev parent reply other threads:[~2004-09-06 0:54 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-05 5:44 Nick Piggin
2004-09-05 5:45 ` [RFC][PATCH 1/3] account free buddy areas Nick Piggin
2004-09-05 5:46 ` [RFC][PATCH 2/3] alloc-order watermarks Nick Piggin
2004-09-05 5:47 ` [RFC][PATCH 3/3] teach kswapd about watermarks Nick Piggin
2004-09-05 6:04 ` David S. Miller
2004-09-05 6:20 ` Nick Piggin
2004-09-05 5:50 ` [RFC][PATCH 2/3] alloc-order watermarks Nick Piggin
2004-09-05 6:13 ` [RFC][PATCH 1/3] account free buddy areas Nick Piggin
2004-09-05 6:02 ` [RFC][PATCH 0/3] beat kswapd with the proverbial clue-bat David S. Miller
2004-09-05 6:16 ` Nick Piggin
2004-09-05 10:13 ` Nick Piggin
2004-09-05 17:24 ` Linus Torvalds
2004-09-05 17:36 ` Martin J. Bligh
2004-09-05 17:37 ` Arjan van de Ven
2004-09-05 17:58 ` Linus Torvalds
2004-09-05 18:41 ` Arjan van de Ven
2004-09-06 1:35 ` Nick Piggin
2004-09-15 13:27 ` Jörn Engel
2004-09-15 13:29 ` Arjan van de Ven
2004-09-15 13:34 ` Jörn Engel
2004-09-15 13:39 ` Arjan van de Ven
2004-09-15 14:18 ` Jörn Engel
2004-09-06 1:09 ` Nick Piggin
2004-09-05 6:09 ` Andrew Morton
2004-09-05 6:26 ` Nick Piggin
2004-09-05 6:27 ` Anton Blanchard
2004-09-05 10:09 ` Nick Piggin
2004-09-06 3:33 ` David S. Miller
2004-09-06 8:55 ` Nick Piggin
2004-09-05 16:49 ` Linus Torvalds
2004-09-06 0:54 ` Nick Piggin [this message]
2004-09-06 1:49 ` Nick Piggin
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=413BB55B.9000106@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=torvalds@osdl.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