diff options
Diffstat (limited to 'src/ratelimiter.c')
-rw-r--r-- | src/ratelimiter.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/ratelimiter.c b/src/ratelimiter.c index b3fdd4c..ebad1f4 100644 --- a/src/ratelimiter.c +++ b/src/ratelimiter.c @@ -2,9 +2,8 @@ #include "ratelimiter.h" #include <linux/siphash.h> -#include <linux/vmalloc.h> +#include <linux/mm.h> #include <linux/slab.h> -#include <linux/hashtable.h> #include <net/ip.h> static struct kmem_cache *entry_cache; @@ -154,18 +153,16 @@ int ratelimiter_init(void) table_size = (totalram_pages > (1 << 30) / PAGE_SIZE) ? 8192 : max_t(unsigned long, 16, roundup_pow_of_two((totalram_pages << PAGE_SHIFT) / (1 << 14) / sizeof(struct hlist_head))); max_entries = table_size * 8; - table_v4 = vmalloc(table_size * sizeof(struct hlist_head)); + table_v4 = kvzalloc(table_size * sizeof(struct hlist_head), GFP_KERNEL); if (!table_v4) goto err_kmemcache; - __hash_init(table_v4, table_size); #if IS_ENABLED(CONFIG_IPV6) - table_v6 = vmalloc(table_size * sizeof(struct hlist_head)); + table_v6 = kvzalloc(table_size * sizeof(struct hlist_head), GFP_KERNEL); if (!table_v6) { - vfree(table_v4); + kvfree(table_v4); goto err_kmemcache; } - __hash_init(table_v6, table_size); #endif queue_delayed_work(system_power_efficient_wq, &gc_work, HZ); @@ -187,9 +184,9 @@ void ratelimiter_uninit(void) cancel_delayed_work_sync(&gc_work); gc_entries(NULL); synchronize_rcu(); - vfree(table_v4); + kvfree(table_v4); #if IS_ENABLED(CONFIG_IPV6) - vfree(table_v6); + kvfree(table_v6); #endif kmem_cache_destroy(entry_cache); } |