aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/bpf/stackmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/bpf/stackmap.c')
-rw-r--r--kernel/bpf/stackmap.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c
index 31147d730abf..135be433e9a0 100644
--- a/kernel/bpf/stackmap.c
+++ b/kernel/bpf/stackmap.c
@@ -31,7 +31,8 @@ static int prealloc_elems_and_freelist(struct bpf_stack_map *smap)
31 u32 elem_size = sizeof(struct stack_map_bucket) + smap->map.value_size; 31 u32 elem_size = sizeof(struct stack_map_bucket) + smap->map.value_size;
32 int err; 32 int err;
33 33
34 smap->elems = bpf_map_area_alloc(elem_size * smap->map.max_entries); 34 smap->elems = bpf_map_area_alloc(elem_size * smap->map.max_entries,
35 smap->map.numa_node);
35 if (!smap->elems) 36 if (!smap->elems)
36 return -ENOMEM; 37 return -ENOMEM;
37 38
@@ -59,7 +60,7 @@ static struct bpf_map *stack_map_alloc(union bpf_attr *attr)
59 if (!capable(CAP_SYS_ADMIN)) 60 if (!capable(CAP_SYS_ADMIN))
60 return ERR_PTR(-EPERM); 61 return ERR_PTR(-EPERM);
61 62
62 if (attr->map_flags) 63 if (attr->map_flags & ~BPF_F_NUMA_NODE)
63 return ERR_PTR(-EINVAL); 64 return ERR_PTR(-EINVAL);
64 65
65 /* check sanity of attributes */ 66 /* check sanity of attributes */
@@ -75,7 +76,7 @@ static struct bpf_map *stack_map_alloc(union bpf_attr *attr)
75 if (cost >= U32_MAX - PAGE_SIZE) 76 if (cost >= U32_MAX - PAGE_SIZE)
76 return ERR_PTR(-E2BIG); 77 return ERR_PTR(-E2BIG);
77 78
78 smap = bpf_map_area_alloc(cost); 79 smap = bpf_map_area_alloc(cost, bpf_map_attr_numa_node(attr));
79 if (!smap) 80 if (!smap)
80 return ERR_PTR(-ENOMEM); 81 return ERR_PTR(-ENOMEM);
81 82
@@ -91,6 +92,7 @@ static struct bpf_map *stack_map_alloc(union bpf_attr *attr)
91 smap->map.map_flags = attr->map_flags; 92 smap->map.map_flags = attr->map_flags;
92 smap->n_buckets = n_buckets; 93 smap->n_buckets = n_buckets;
93 smap->map.pages = round_up(cost, PAGE_SIZE) >> PAGE_SHIFT; 94 smap->map.pages = round_up(cost, PAGE_SIZE) >> PAGE_SHIFT;
95 smap->map.numa_node = bpf_map_attr_numa_node(attr);
94 96
95 err = bpf_map_precharge_memlock(smap->map.pages); 97 err = bpf_map_precharge_memlock(smap->map.pages);
96 if (err) 98 if (err)