[PATCH] ila: simplify a strange allocation pattern
From: Michal Hocko
Date: Fri Jan 06 2017 - 04:52:20 EST
alloc_ila_locks seemed to c&p from alloc_bucket_locks allocation pattern
which is quite unusual. We are preferring vmalloc when CONFIG_NUMA is
enabled which doesn't make much sense because there is no special NUMA
locality handled in that code path. Let's just simplify the code and
use kvmalloc helper which is a transparent way to use kmalloc with
vmalloc fallback.
Signed-off-by: Michal Hocko <mhocko@xxxxxxxx>
---
net/ipv6/ila/ila_xlat.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/net/ipv6/ila/ila_xlat.c b/net/ipv6/ila/ila_xlat.c
index af8f52ee7180..2fd5ca151dcf 100644
--- a/net/ipv6/ila/ila_xlat.c
+++ b/net/ipv6/ila/ila_xlat.c
@@ -41,13 +41,7 @@ static int alloc_ila_locks(struct ila_net *ilan)
size = roundup_pow_of_two(nr_pcpus * LOCKS_PER_CPU);
if (sizeof(spinlock_t) != 0) {
-#ifdef CONFIG_NUMA
- if (size * sizeof(spinlock_t) > PAGE_SIZE)
- ilan->locks = vmalloc(size * sizeof(spinlock_t));
- else
-#endif
- ilan->locks = kmalloc_array(size, sizeof(spinlock_t),
- GFP_KERNEL);
+ ilan->locks = kvmalloc(size * sizeof(spinlock_t), GFP_KERNEL);
if (!ilan->locks)
return -ENOMEM;
for (i = 0; i < size; i++)
--
2.11.0
--
Michal Hocko
SUSE Labs