Re: [PATCH] mm/zswap : NUMA aware allocation for zswap_dstmem
On Tue, May 27, 2014 at 09:55:49AM -0700, Eric Dumazet wrote: > From: Eric Dumazet > > zswap_dstmem is a percpu block of memory, which should > be allocated using kmalloc_node(), to get better NUMA > locality. > > Without it, all the blocks are allocated from a single node. > > Signed-off-by: Eric Dumazet Acked-by: Seth Jennings > --- > mm/zswap.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/zswap.c b/mm/zswap.c > index aeaef0fb5624..008388fe7b0f 100644 > --- a/mm/zswap.c > +++ b/mm/zswap.c > @@ -347,7 +347,7 @@ static int __zswap_cpu_notifier(unsigned long action, > unsigned long cpu) > return NOTIFY_BAD; > } > *per_cpu_ptr(zswap_comp_pcpu_tfms, cpu) = tfm; > - dst = kmalloc(PAGE_SIZE * 2, GFP_KERNEL); > + dst = kmalloc_node(PAGE_SIZE * 2, GFP_KERNEL, cpu_to_node(cpu)); > if (!dst) { > pr_err("can't allocate compressor buffer\n"); > crypto_free_comp(tfm); > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] mm/zswap : NUMA aware allocation for zswap_dstmem
On Tue, May 27, 2014 at 09:55:49AM -0700, Eric Dumazet wrote: From: Eric Dumazet eduma...@google.com zswap_dstmem is a percpu block of memory, which should be allocated using kmalloc_node(), to get better NUMA locality. Without it, all the blocks are allocated from a single node. Signed-off-by: Eric Dumazet eduma...@google.com Acked-by: Seth Jennings sjenni...@variantweb.net --- mm/zswap.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/zswap.c b/mm/zswap.c index aeaef0fb5624..008388fe7b0f 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -347,7 +347,7 @@ static int __zswap_cpu_notifier(unsigned long action, unsigned long cpu) return NOTIFY_BAD; } *per_cpu_ptr(zswap_comp_pcpu_tfms, cpu) = tfm; - dst = kmalloc(PAGE_SIZE * 2, GFP_KERNEL); + dst = kmalloc_node(PAGE_SIZE * 2, GFP_KERNEL, cpu_to_node(cpu)); if (!dst) { pr_err(can't allocate compressor buffer\n); crypto_free_comp(tfm); -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] mm/zswap : NUMA aware allocation for zswap_dstmem
On Tue, 27 May 2014, Eric Dumazet wrote: > From: Eric Dumazet > > zswap_dstmem is a percpu block of memory, which should > be allocated using kmalloc_node(), to get better NUMA > locality. > > Without it, all the blocks are allocated from a single node. > > Signed-off-by: Eric Dumazet Acked-by: David Rientjes cpu_to_node(cpu) should return the correct node that was parsed from the SRAT on x86 at boot during CPU_UP_PREPARE. If any platform returns NUMA_NO_NODE, the worst case scenario is that we get local allocation anyway. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] mm/zswap : NUMA aware allocation for zswap_dstmem
On Tue, 27 May 2014, Eric Dumazet wrote: From: Eric Dumazet eduma...@google.com zswap_dstmem is a percpu block of memory, which should be allocated using kmalloc_node(), to get better NUMA locality. Without it, all the blocks are allocated from a single node. Signed-off-by: Eric Dumazet eduma...@google.com Acked-by: David Rientjes rient...@google.com cpu_to_node(cpu) should return the correct node that was parsed from the SRAT on x86 at boot during CPU_UP_PREPARE. If any platform returns NUMA_NO_NODE, the worst case scenario is that we get local allocation anyway. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/