Thread (15 messages) flat view 15 messages, 6 authors, 2017-10-19

Re: [net-next V8 PATCH 1/5] bpf: introduce new bpf cpu map type BPF_MAP_TYPE_CPUMAP

From: Yann Ylavic <hidden>
Date: 2017-10-18 07:46:01

On Mon, Oct 16, 2017 at 12:19 PM, Jesper Dangaard Brouer
[off-list ref] wrote:
+
+       /* Notice returns -EPERM on if map size is larger than memlock limit */
+       ret = bpf_map_precharge_memlock(cmap->map.pages);
+       if (ret) {
+               err = ret;
+               goto free_cmap;
+       }
+
+       /* A per cpu bitfield with a bit per possible CPU in map  */
+       cmap->flush_needed = __alloc_percpu(cpu_map_bitmap_size(attr),
+                                           __alignof__(unsigned long));
+       if (!cmap->flush_needed)
+               goto free_cmap;
+
+       /* Alloc array for possible remote "destination" CPUs */
+       cmap->cpu_map = bpf_map_area_alloc(cmap->map.max_entries *
+                                          sizeof(struct bpf_cpu_map_entry *),
+                                          cmap->map.numa_node);
+       if (!cmap->cpu_map)
ret = -ENOMEM; ?
+               goto free_percpu;
+
+       return &cmap->map;
+free_percpu:
+       free_percpu(cmap->flush_needed);
+free_cmap:
+       kfree(cmap);
+       return ERR_PTR(err);
+}

Regards,
Yann.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help