mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
bpf: Allow numa selection in INNER_LRU_HASH_PREALLOC test of map_perf_test
This patch makes the needed changes to allow each process of the INNER_LRU_HASH_PREALLOC test to provide its numa node id when creating the lru map. Signed-off-by: Martin KaFai Lau <[email protected]> Acked-by: Daniel Borkmann <[email protected]> Acked-by: Alexei Starovoitov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
96eabe7a40
commit
ad17d0e6c7
8 changed files with 69 additions and 16 deletions
|
|
@ -57,8 +57,9 @@ static inline int sys_bpf(enum bpf_cmd cmd, union bpf_attr *attr,
|
|||
return syscall(__NR_bpf, cmd, attr, size);
|
||||
}
|
||||
|
||||
int bpf_create_map(enum bpf_map_type map_type, int key_size,
|
||||
int value_size, int max_entries, __u32 map_flags)
|
||||
int bpf_create_map_node(enum bpf_map_type map_type, int key_size,
|
||||
int value_size, int max_entries, __u32 map_flags,
|
||||
int node)
|
||||
{
|
||||
union bpf_attr attr;
|
||||
|
||||
|
|
@ -69,12 +70,24 @@ int bpf_create_map(enum bpf_map_type map_type, int key_size,
|
|||
attr.value_size = value_size;
|
||||
attr.max_entries = max_entries;
|
||||
attr.map_flags = map_flags;
|
||||
if (node >= 0) {
|
||||
attr.map_flags |= BPF_F_NUMA_NODE;
|
||||
attr.numa_node = node;
|
||||
}
|
||||
|
||||
return sys_bpf(BPF_MAP_CREATE, &attr, sizeof(attr));
|
||||
}
|
||||
|
||||
int bpf_create_map_in_map(enum bpf_map_type map_type, int key_size,
|
||||
int inner_map_fd, int max_entries, __u32 map_flags)
|
||||
int bpf_create_map(enum bpf_map_type map_type, int key_size,
|
||||
int value_size, int max_entries, __u32 map_flags)
|
||||
{
|
||||
return bpf_create_map_node(map_type, key_size, value_size,
|
||||
max_entries, map_flags, -1);
|
||||
}
|
||||
|
||||
int bpf_create_map_in_map_node(enum bpf_map_type map_type, int key_size,
|
||||
int inner_map_fd, int max_entries,
|
||||
__u32 map_flags, int node)
|
||||
{
|
||||
union bpf_attr attr;
|
||||
|
||||
|
|
@ -86,10 +99,21 @@ int bpf_create_map_in_map(enum bpf_map_type map_type, int key_size,
|
|||
attr.inner_map_fd = inner_map_fd;
|
||||
attr.max_entries = max_entries;
|
||||
attr.map_flags = map_flags;
|
||||
if (node >= 0) {
|
||||
attr.map_flags |= BPF_F_NUMA_NODE;
|
||||
attr.numa_node = node;
|
||||
}
|
||||
|
||||
return sys_bpf(BPF_MAP_CREATE, &attr, sizeof(attr));
|
||||
}
|
||||
|
||||
int bpf_create_map_in_map(enum bpf_map_type map_type, int key_size,
|
||||
int inner_map_fd, int max_entries, __u32 map_flags)
|
||||
{
|
||||
return bpf_create_map_in_map_node(map_type, key_size, inner_map_fd,
|
||||
max_entries, map_flags, -1);
|
||||
}
|
||||
|
||||
int bpf_load_program(enum bpf_prog_type type, const struct bpf_insn *insns,
|
||||
size_t insns_cnt, const char *license,
|
||||
__u32 kern_version, char *log_buf, size_t log_buf_sz)
|
||||
|
|
|
|||
|
|
@ -24,8 +24,14 @@
|
|||
#include <linux/bpf.h>
|
||||
#include <stddef.h>
|
||||
|
||||
int bpf_create_map_node(enum bpf_map_type map_type, int key_size,
|
||||
int value_size, int max_entries, __u32 map_flags,
|
||||
int node);
|
||||
int bpf_create_map(enum bpf_map_type map_type, int key_size, int value_size,
|
||||
int max_entries, __u32 map_flags);
|
||||
int bpf_create_map_in_map_node(enum bpf_map_type map_type, int key_size,
|
||||
int inner_map_fd, int max_entries,
|
||||
__u32 map_flags, int node);
|
||||
int bpf_create_map_in_map(enum bpf_map_type map_type, int key_size,
|
||||
int inner_map_fd, int max_entries, __u32 map_flags);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue