OSDN Git Service

selftests/bpf: extend the storage test to test per-cpu cgroup storage
authorRoman Gushchin <guro@fb.com>
Fri, 28 Sep 2018 14:45:55 +0000 (14:45 +0000)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 1 Oct 2018 14:18:33 +0000 (16:18 +0200)
commit919646d2a3a90465cf8b30a7616c63005bef7570
tree634c6cf6f92b2ebf441a39aa6e0db43d4d5733b0
parenta3c6054f81e2c436d6b53b8060df996fec0cbfdb
selftests/bpf: extend the storage test to test per-cpu cgroup storage

This test extends the cgroup storage test to use per-cpu flavor
of the cgroup storage as well.

The test initializes a per-cpu cgroup storage to some non-zero initial
value (1000), and then simple bumps a per-cpu counter each time
the shared counter is atomically incremented. Then it reads all
per-cpu areas from the userspace side, and checks that the sum
of values adds to the expected sum.

Expected output:
  $ ./test_cgroup_storage
  test_cgroup_storage:PASS

Signed-off-by: Roman Gushchin <guro@fb.com>
Acked-by: Song Liu <songliubraving@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/testing/selftests/bpf/test_cgroup_storage.c