diff options
Diffstat (limited to 'kernel/bpf/hashtab.c')
-rw-r--r-- | kernel/bpf/hashtab.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c index 3f2bb58952d8..a753bbe7df0a 100644 --- a/kernel/bpf/hashtab.c +++ b/kernel/bpf/hashtab.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/bpf.h> | 13 | #include <linux/bpf.h> |
14 | #include <linux/jhash.h> | 14 | #include <linux/jhash.h> |
15 | #include <linux/filter.h> | 15 | #include <linux/filter.h> |
16 | #include <linux/vmalloc.h> | ||
17 | #include "percpu_freelist.h" | 16 | #include "percpu_freelist.h" |
18 | #include "bpf_lru_list.h" | 17 | #include "bpf_lru_list.h" |
19 | 18 | ||
@@ -103,7 +102,7 @@ static void htab_free_elems(struct bpf_htab *htab) | |||
103 | free_percpu(pptr); | 102 | free_percpu(pptr); |
104 | } | 103 | } |
105 | free_elems: | 104 | free_elems: |
106 | vfree(htab->elems); | 105 | bpf_map_area_free(htab->elems); |
107 | } | 106 | } |
108 | 107 | ||
109 | static struct htab_elem *prealloc_lru_pop(struct bpf_htab *htab, void *key, | 108 | static struct htab_elem *prealloc_lru_pop(struct bpf_htab *htab, void *key, |
@@ -125,7 +124,8 @@ static int prealloc_init(struct bpf_htab *htab) | |||
125 | { | 124 | { |
126 | int err = -ENOMEM, i; | 125 | int err = -ENOMEM, i; |
127 | 126 | ||
128 | htab->elems = vzalloc(htab->elem_size * htab->map.max_entries); | 127 | htab->elems = bpf_map_area_alloc(htab->elem_size * |
128 | htab->map.max_entries); | ||
129 | if (!htab->elems) | 129 | if (!htab->elems) |
130 | return -ENOMEM; | 130 | return -ENOMEM; |
131 | 131 | ||
@@ -320,14 +320,10 @@ static struct bpf_map *htab_map_alloc(union bpf_attr *attr) | |||
320 | goto free_htab; | 320 | goto free_htab; |
321 | 321 | ||
322 | err = -ENOMEM; | 322 | err = -ENOMEM; |
323 | htab->buckets = kmalloc_array(htab->n_buckets, sizeof(struct bucket), | 323 | htab->buckets = bpf_map_area_alloc(htab->n_buckets * |
324 | GFP_USER | __GFP_NOWARN); | 324 | sizeof(struct bucket)); |
325 | 325 | if (!htab->buckets) | |
326 | if (!htab->buckets) { | 326 | goto free_htab; |
327 | htab->buckets = vmalloc(htab->n_buckets * sizeof(struct bucket)); | ||
328 | if (!htab->buckets) | ||
329 | goto free_htab; | ||
330 | } | ||
331 | 327 | ||
332 | for (i = 0; i < htab->n_buckets; i++) { | 328 | for (i = 0; i < htab->n_buckets; i++) { |
333 | INIT_HLIST_HEAD(&htab->buckets[i].head); | 329 | INIT_HLIST_HEAD(&htab->buckets[i].head); |
@@ -354,7 +350,7 @@ static struct bpf_map *htab_map_alloc(union bpf_attr *attr) | |||
354 | free_extra_elems: | 350 | free_extra_elems: |
355 | free_percpu(htab->extra_elems); | 351 | free_percpu(htab->extra_elems); |
356 | free_buckets: | 352 | free_buckets: |
357 | kvfree(htab->buckets); | 353 | bpf_map_area_free(htab->buckets); |
358 | free_htab: | 354 | free_htab: |
359 | kfree(htab); | 355 | kfree(htab); |
360 | return ERR_PTR(err); | 356 | return ERR_PTR(err); |
@@ -1014,7 +1010,7 @@ static void htab_map_free(struct bpf_map *map) | |||
1014 | prealloc_destroy(htab); | 1010 | prealloc_destroy(htab); |
1015 | 1011 | ||
1016 | free_percpu(htab->extra_elems); | 1012 | free_percpu(htab->extra_elems); |
1017 | kvfree(htab->buckets); | 1013 | bpf_map_area_free(htab->buckets); |
1018 | kfree(htab); | 1014 | kfree(htab); |
1019 | } | 1015 | } |
1020 | 1016 | ||