From patchwork Mon Dec 6 16:43:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 74392 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id C3AE5B70E2 for ; Tue, 7 Dec 2010 03:43:27 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753669Ab0LFQnW (ORCPT ); Mon, 6 Dec 2010 11:43:22 -0500 Received: from vpn.id2.novell.com ([195.33.99.129]:48379 "EHLO vpn.id2.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753595Ab0LFQnW convert rfc822-to-8bit (ORCPT ); Mon, 6 Dec 2010 11:43:22 -0500 Received: from EMEA1-MTA by vpn.id2.novell.com with Novell_GroupWise; Mon, 06 Dec 2010 17:13:43 +0000 Message-Id: <4CFD20B60200007800026281@vpn.id2.novell.com> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Mon, 06 Dec 2010 16:43:18 +0000 From: "Jan Beulich" To: Cc: Subject: [PATCH] use total_highpages when calculating lowmem-only allocation sizes (netfilter) Mime-Version: 1.0 Content-Disposition: inline Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org For those (large) table allocations that come only from lowmem, the total amount of memory shouldn't really matter. Signed-off-by: Jan Beulich --- net/netfilter/nf_conntrack_core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- linux-2.6.37-rc4/net/netfilter/nf_conntrack_core.c +++ 2.6.37-rc4-use-totalhigh_pages/net/netfilter/nf_conntrack_core.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -1398,10 +1399,12 @@ static int nf_conntrack_init_init_net(vo /* Idea from tcp.c: use 1/16384 of memory. On i386: 32MB * machine has 512 buckets. >= 1GB machines have 16384 buckets. */ if (!nf_conntrack_htable_size) { + unsigned long nr_pages = totalram_pages - totalhigh_pages; + nf_conntrack_htable_size - = (((totalram_pages << PAGE_SHIFT) / 16384) + = (((nr_pages << PAGE_SHIFT) / 16384) / sizeof(struct hlist_head)); - if (totalram_pages > (1024 * 1024 * 1024 / PAGE_SIZE)) + if (nr_pages > (1024 * 1024 * 1024 / PAGE_SIZE)) nf_conntrack_htable_size = 16384; if (nf_conntrack_htable_size < 32) nf_conntrack_htable_size = 32;