Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965029AbVIUVh1 (ORCPT ); Wed, 21 Sep 2005 17:37:27 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S965024AbVIUVh1 (ORCPT ); Wed, 21 Sep 2005 17:37:27 -0400 Received: from mf00.sitadelle.com ([212.94.174.67]:18010 "EHLO smtp.cegetel.net") by vger.kernel.org with ESMTP id S965008AbVIUVhY (ORCPT ); Wed, 21 Sep 2005 17:37:24 -0400 Message-ID: <4331D290.6070104@cosmosbay.com> Date: Wed, 21 Sep 2005 23:37:20 +0200 From: Eric Dumazet User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: fr, en MIME-Version: 1.0 To: linux-kernel@vger.kernel.org, netfilter-devel@lists.netfilter.org, netdev@vger.kernel.org Cc: Andi Kleen Subject: [PATCH 3/3] netfilter : 3 patches to boost ip_tables performance References: <432EF0C5.5090908@cosmosbay.com> <200509191948.55333.ak@suse.de> <432FDAC5.3040801@cosmosbay.com> <200509201830.20689.ak@suse.de> <433082DE.3060308@cosmosbay.com> <43308324.70403@cosmosbay.com> In-Reply-To: <43308324.70403@cosmosbay.com> Content-Type: multipart/mixed; boundary="------------030002070203020903060702" Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 19270 Lines: 289 This is a multi-part message in MIME format. --------------030002070203020903060702 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Patch 3/3 (please apply after Patch 2/3) 3) NUMA allocation. Part of the performance problem we have with netfilter is memory allocation is not NUMA aware, but 'only' SMP aware (ie each CPU normally touch separate cache lines) Even with small iptables rules, the cost of this misplacement can be high on common workloads. Instead of using one vmalloc() area (located in the node of the iptables process), we now allocate an area for each possible CPU, using NUMA policy (MPOL_PREFERRED) so that memory should be allocated in the CPU's node if possible. If the size of ipt_table is small enough (less than one page), we use kmalloc_node() instead of vmalloc(), to use less memory and less TLB entries) in small setups. Please note that this patch doesnt change the number of allocated bytes, only the location of allocated zones. Note2 : This patch depends on another patch that declares sys_set_mempolicy() in include/linux/syscalls.h ( http://marc.theaimsgroup.com/?l=linux-kernel&m=112725288622984&w=2 ) Signed-off-by: Eric Dumazet --------------030002070203020903060702 Content-Type: text/plain; name="patch_ip_tables_numa.3" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="patch_ip_tables_numa.3" LS0tIGxpbnV4LTIuNi9uZXQvaXB2NC9uZXRmaWx0ZXIvaXBfdGFibGVzLmMJMjAwNS0wOS0y MiAwMDo0NDozNC4wMDAwMDAwMDAgKzAyMDAKKysrIGxpbnV4LTIuNi1lZC9uZXQvaXB2NC9u ZXRmaWx0ZXIvaXBfdGFibGVzLmMJMjAwNS0wOS0yMiAwMDo1NzoxNS4wMDAwMDAwMDAgKzAy MDAKQEAgLTE3LDYgKzE3LDggQEAKICNpbmNsdWRlIDxsaW51eC9za2J1ZmYuaD4KICNpbmNs dWRlIDxsaW51eC9rbW9kLmg+CiAjaW5jbHVkZSA8bGludXgvdm1hbGxvYy5oPgorI2luY2x1 ZGUgPGxpbnV4L21lbXBvbGljeS5oPgorI2luY2x1ZGUgPGxpbnV4L3N5c2NhbGxzLmg+CiAj aW5jbHVkZSA8bGludXgvbmV0ZGV2aWNlLmg+CiAjaW5jbHVkZSA8bGludXgvbW9kdWxlLmg+ CiAjaW5jbHVkZSA8bGludXgvdGNwLmg+CkBAIC04MiwxMSArODQsNiBAQAogICAgY29udGV4 dCBzdG9wcyBwYWNrZXRzIGNvbWluZyB0aHJvdWdoIGFuZCBhbGxvd3MgdXNlciBjb250ZXh0 IHRvIHJlYWQKICAgIHRoZSBjb3VudGVycyBvciB1cGRhdGUgdGhlIHJ1bGVzLgogCi0gICBU byBiZSBjYWNoZSBmcmllbmRseSBvbiBTTVAsIHdlIGFycmFuZ2UgdGhlbSBsaWtlIHNvOgot ICAgWyBuLWVudHJpZXMgXQotICAgLi4uIGNhY2hlLWFsaWduIHBhZGRp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ci0JdmZyZWUodGFibGUtPnBy aXZhdGUpOworCXB1dF9jcHUoKTsKKwlmcmVlX3RhYmxlX2luZm8odGFibGUtPnByaXZhdGUp OwogI2lmZGVmIENPTkZJR19TTVAKIAlmcmVlX3BlcmNwdSh0YWJsZS0+bG9ja19wKTsKIAl0 YWJsZS0+bG9ja19wID0gTlVMTDsK --------------030002070203020903060702-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/