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