]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[IPV4]: Limit rt cache size properly.
authorKirill Korotaev <dev@sw.ru>
Wed, 8 Nov 2006 07:12:01 +0000 (08:12 +0100)
committerAdrian Bunk <bunk@stusta.de>
Wed, 8 Nov 2006 07:12:01 +0000 (08:12 +0100)
During OpenVZ stress testing we found that UDP traffic with random src
can generate too much excessive rt hash growing leading finally to OOM
and kernel panics.

It was found that for 4GB i686 system (having 1048576 total pages and
225280 normal zone pages) kernel allocates the following route hash:
syslog: IP route cache hash table entries: 262144 (order: 8, 1048576
bytes) => ip_rt_max_size = 4194304 entries, i.e.  max rt size is
4194304 * 256b = 1Gb of RAM > normal_zone

Attached the patch which removes HASH_HIGHMEM flag from
alloc_large_system_hash() call.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
net/ipv4/route.c

index a67955e26371ffc5c0bfc8661bb5d79b951f0395..c2cd901327bd7b3bbdbdd5edc95c981eb300a605 100644 (file)
@@ -3153,7 +3153,7 @@ int __init ip_rt_init(void)
                                        rhash_entries,
                                        (num_physpages >= 128 * 1024) ?
                                        15 : 17,
-                                       HASH_HIGHMEM,
+                                       0,
                                        &rt_hash_log,
                                        &rt_hash_mask,
                                        0);