netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
To: Kirill Korotaev <dev@sw.ru>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH] limit rt cache size
Date: Mon, 7 Aug 2006 20:48:42 +0400	[thread overview]
Message-ID: <20060807164842.GA3412@ms2.inr.ac.ru> (raw)
In-Reply-To: <44D75EF8.1070901@sw.ru>

Hello!

> 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

Grrr... Indeed.


> Attached the patch which removes HASH_HIGHMEM flag from
> alloc_large_system_hash() call. However, I'm not sure whether
> it should be removed as well for TCP tcp_hashinfo.ehash and
> tcp_hashinfo.bhash (as those are probably limited by number of files?).

The patch looks OK. But I am not sure too.

To be honest, I do not understand the sense of HASH_HIGHMEM flag.
At the first sight, hash table eats low memory, objects hashed in this table
also eat low memory. Why is its size calculated from total memory?
But taking into account that this flag is used only by tcp.c and route.c,
both of which feed on low memory, I miss something important.

Let's ask people on netdev.


What's about routing cache size, it looks like it is another bug.
route.c should not force rt_max_size = 16*rt_hash_size.
I think it should consult available memory and to limit rt_max_size
to some reasonable value, even if hash size is too high.



> --- ./net/ipv4/route.c.xrt	2006-07-14 19:08:33.000000000 +0400
> +++ ./net/ipv4/route.c	2006-08-07 18:25:37.000000000 +0400
> @@ -3149,7 +3149,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);


       reply	other threads:[~2006-08-07 16:49 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <44D75EF8.1070901@sw.ru>
2006-08-07 16:48 ` Alexey Kuznetsov [this message]
2006-08-08  3:42   ` [PATCH] limit rt cache size David Miller
2006-08-08  5:11     ` Andi Kleen
2006-08-08  6:18       ` David Miller
2006-08-08  6:53         ` Andi Kleen
2006-08-08  7:01           ` David Miller
2006-08-08 12:54             ` Kirill Korotaev
2006-08-08 12:58               ` Andi Kleen
2006-08-08 20:37       ` akepner
2006-08-08 23:23         ` Andi Kleen
2006-08-09  0:06           ` akepner
2006-08-09  0:11           ` David Miller
2006-08-09  0:11             ` akepner
2006-08-09  0:22               ` David Miller
2006-08-09  1:02               ` Andi Kleen
2006-08-09 16:16                 ` akepner
2006-08-09 16:32                   ` Andi Kleen
2006-08-10  0:02                     ` David Miller
2006-08-09  8:05               ` Kirill Korotaev
2006-08-09  0:24             ` Andi Kleen
2006-08-09  0:32               ` David Miller
2006-08-09  8:09               ` Kirill Korotaev
2006-08-09  8:53                 ` Eric Dumazet
2006-08-09  9:22                   ` David Miller
2006-08-08  8:17     ` Kirill Korotaev
2006-08-08  8:34       ` David Miller
2006-08-08  8:57     ` Eric Dumazet
2006-08-08  9:12       ` David Miller

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=20060807164842.GA3412@ms2.inr.ac.ru \
    --to=kuznet@ms2.inr.ac.ru \
    --cc=davem@davemloft.net \
    --cc=dev@sw.ru \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).