aboutsummaryrefslogtreecommitdiff
path: root/include/linux/bpf.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-08-19 21:35:44 -0700
committerDavid S. Miller <davem@davemloft.net>2017-08-19 21:35:44 -0700
commit06d0a11f6e4a1f576937758f7fbbbe8ad398e0ef (patch)
treed6350b4b468bb9ca5ebb40f73758af26ec36082f /include/linux/bpf.h
parentbd76b87962833f6e55264030a227be0f090b1286 (diff)
parentad17d0e6c708805bf9e6686eb747cc528b702e67 (diff)
Merge branch 'bpf-Allow-selecting-numa-node-during-map-creation'
Martin KaFai Lau says: ==================== bpf: Allow selecting numa node during map creation This series allows user to pick the numa node during map creation. The first patch has the details ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/bpf.h')
-rw-r--r--include/linux/bpf.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 1cc6c5ff61ec..55b88e329804 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -51,6 +51,7 @@ struct bpf_map {
u32 map_flags;
u32 pages;
u32 id;
+ int numa_node;
struct user_struct *user;
const struct bpf_map_ops *ops;
struct work_struct work;
@@ -264,7 +265,7 @@ struct bpf_map * __must_check bpf_map_inc(struct bpf_map *map, bool uref);
void bpf_map_put_with_uref(struct bpf_map *map);
void bpf_map_put(struct bpf_map *map);
int bpf_map_precharge_memlock(u32 pages);
-void *bpf_map_area_alloc(size_t size);
+void *bpf_map_area_alloc(size_t size, int numa_node);
void bpf_map_area_free(void *base);
extern int sysctl_unprivileged_bpf_disabled;
@@ -316,6 +317,13 @@ struct net_device *__dev_map_lookup_elem(struct bpf_map *map, u32 key);
void __dev_map_insert_ctx(struct bpf_map *map, u32 index);
void __dev_map_flush(struct bpf_map *map);
+/* Return map's numa specified by userspace */
+static inline int bpf_map_attr_numa_node(const union bpf_attr *attr)
+{
+ return (attr->map_flags & BPF_F_NUMA_NODE) ?
+ attr->numa_node : NUMA_NO_NODE;
+}
+
#else
static inline struct bpf_prog *bpf_prog_get(u32 ufd)
{