mirror of https://gitee.com/openkylin/linux.git
bpf: lru: Cleanup test_lru_map.c
This patch does the following cleanup on test_lru_map.c 1) Fix indentation (Replace spaces by tabs) 2) Remove redundant BPF_F_NO_COMMON_LRU test 3) Simplify some comments Signed-off-by: Martin KaFai Lau <kafai@fb.com> Acked-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
9746f85686
commit
6467acbc70
|
@ -191,12 +191,7 @@ static void test_lru_sanity1(int map_type, int map_flags, unsigned int tgt_free)
|
||||||
int next_cpu = 0;
|
int next_cpu = 0;
|
||||||
|
|
||||||
if (map_flags & BPF_F_NO_COMMON_LRU)
|
if (map_flags & BPF_F_NO_COMMON_LRU)
|
||||||
/* Ther percpu lru list (i.e each cpu has its own LRU
|
/* This test is only applicable to common LRU list */
|
||||||
* list) does not have a local free list. Hence,
|
|
||||||
* it will only free old nodes till there is no free
|
|
||||||
* from the LRU list. Hence, this test does not apply
|
|
||||||
* to BPF_F_NO_COMMON_LRU
|
|
||||||
*/
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
printf("%s (map_type:%d map_flags:0x%X): ", __func__, map_type,
|
printf("%s (map_type:%d map_flags:0x%X): ", __func__, map_type,
|
||||||
|
@ -273,12 +268,7 @@ static void test_lru_sanity2(int map_type, int map_flags, unsigned int tgt_free)
|
||||||
int next_cpu = 0;
|
int next_cpu = 0;
|
||||||
|
|
||||||
if (map_flags & BPF_F_NO_COMMON_LRU)
|
if (map_flags & BPF_F_NO_COMMON_LRU)
|
||||||
/* Ther percpu lru list (i.e each cpu has its own LRU
|
/* This test is only applicable to common LRU list */
|
||||||
* list) does not have a local free list. Hence,
|
|
||||||
* it will only free old nodes till there is no free
|
|
||||||
* from the LRU list. Hence, this test does not apply
|
|
||||||
* to BPF_F_NO_COMMON_LRU
|
|
||||||
*/
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
printf("%s (map_type:%d map_flags:0x%X): ", __func__, map_type,
|
printf("%s (map_type:%d map_flags:0x%X): ", __func__, map_type,
|
||||||
|
@ -290,10 +280,6 @@ static void test_lru_sanity2(int map_type, int map_flags, unsigned int tgt_free)
|
||||||
assert(batch_size * 2 == tgt_free);
|
assert(batch_size * 2 == tgt_free);
|
||||||
|
|
||||||
map_size = tgt_free + batch_size;
|
map_size = tgt_free + batch_size;
|
||||||
if (map_flags & BPF_F_NO_COMMON_LRU)
|
|
||||||
lru_map_fd = create_map(map_type, map_flags,
|
|
||||||
map_size * nr_cpus);
|
|
||||||
else
|
|
||||||
lru_map_fd = create_map(map_type, map_flags, map_size);
|
lru_map_fd = create_map(map_type, map_flags, map_size);
|
||||||
assert(lru_map_fd != -1);
|
assert(lru_map_fd != -1);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue