Re: [RFC][PATCH 0/8] Critical Page Pool

Matthew Dobson
2005-12-06T22:54:49Z

Pavel Machek wrote:
> Hi!
>
>
>>>* Matthew Dobson (colpatch@us.ibm.com) wrote:
>>>
>>>
>>>>/proc/sys/vm/critical_pages: write the number of pages you want to reserve
>>>>for the critical pool into this file
>>>
>>>
>>>How do you size this pool?
>>
>>Trial and error. If you want networking to survive with no memory other
>>than the critical pool for 2 minutes, for example, you pick a random value,
>>block all other allocations (I have a test patch to do this), and send a
>>boatload of packets at the box. If it OOMs, you need a bigger pool.
>>Lather, rinse, repeat.
>
>
> ...and then you find out that your test was not "bad enough" or that
> it needs more memory on different machines. It may be good enough hack
> for your usage, but I do not think it belongs in mainline.
> Pavel

Way late in responding to this, but...

Apropriate sizing of this pool is a known issue. For example, we want to
use it to keep the networking stack alive during extreme memory pressure
situations. The only way to size the pool so as to *guarantee* that it
will not be exhausted during the 2 minute window we need would be to ensure
that the pool has at least (TOTAL_BANDWITH_OF_ALL_NICS * 120 seconds) bytes
available. In the case of a simple system with a single GigE adapter we'd
need (1 gigbit/sec * 120 sec) = 120 gigabits = 15 gigabytes of reserve
pool. That is obviously completely impractical, considering many boxes
have multiple GigE adapters or even 10 GigE adapters. It is also
incredibly unlikely that the NIC will be hit with a continuous stream of
packets at a level that would completely saturate the link. Starting with
an educated guess and some test runs with a reasonble workload should give
you a good idea of how much space you'd *realistically* need to reserve.
Given any reserve size less than the theoretical maximum you obviously
can't *guarantee* the pool won't be exhausted, but you can be pretty confident.