diff options
| author | Martin KaFai Lau <[email protected]> | 2017-08-18 18:28:01 +0000 |
|---|---|---|
| committer | David S. Miller <[email protected]> | 2017-08-20 04:35:43 +0000 |
| commit | ad17d0e6c708805bf9e6686eb747cc528b702e67 (patch) | |
| tree | d6350b4b468bb9ca5ebb40f73758af26ec36082f /samples/bpf/map_perf_test_user.c | |
| parent | bpf: Allow selecting numa node during map creation (diff) | |
| download | kernel-ad17d0e6c708805bf9e6686eb747cc528b702e67.tar.gz kernel-ad17d0e6c708805bf9e6686eb747cc528b702e67.zip | |
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]>
Diffstat (limited to 'samples/bpf/map_perf_test_user.c')
| -rw-r--r-- | samples/bpf/map_perf_test_user.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/samples/bpf/map_perf_test_user.c b/samples/bpf/map_perf_test_user.c index 1a8894b5ac51..bccbf8478e43 100644 --- a/samples/bpf/map_perf_test_user.c +++ b/samples/bpf/map_perf_test_user.c @@ -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); |
