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 <kafai@fb.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Martin KaFai Lau 2017-08-18 11:28:01 -07:00 committed by David S. Miller
parent 96eabe7a40
commit ad17d0e6c7
8 changed files with 69 additions and 16 deletions

View file

@ -97,14 +97,20 @@ static void do_test_lru(enum test_type test, int cpu)
if (test == INNER_LRU_HASH_PREALLOC) {
int outer_fd = map_fd[array_of_lru_hashs_idx];
unsigned int mycpu, mynode;
assert(cpu < MAX_NR_CPUS);
if (cpu) {
ret = syscall(__NR_getcpu, &mycpu, &mynode, NULL);
assert(!ret);
inner_lru_map_fds[cpu] =
bpf_create_map(BPF_MAP_TYPE_LRU_HASH,
sizeof(uint32_t), sizeof(long),
inner_lru_hash_size, 0);
bpf_create_map_node(BPF_MAP_TYPE_LRU_HASH,
sizeof(uint32_t),
sizeof(long),
inner_lru_hash_size, 0,
mynode);
if (inner_lru_map_fds[cpu] == -1) {
printf("cannot create BPF_MAP_TYPE_LRU_HASH %s(%d)\n",
strerror(errno), errno);