Skip to content

Commit a8fce02

Browse files
teawaterAlexei Starovoitov
authored andcommitted
selftests/bpf: Remove kmem subtest from cgroup_iter_memcg
When cgroup.memory=nokmem is set in the kernel command line, kmem accounting is disabled. This causes the test_kmem subtest in cgroup_iter_memcg to fail because it expects non-zero kmem values. Remove the kmem subtest altogether since the remaining subtests (shmem, file, pgfault) already provide sufficient coverage for the cgroup iter memcg functionality. Reviewed-by: JP Kobryn <jp.kobryn@linux.dev> Signed-off-by: Hui Zhu <zhuhui@kylinos.cn> Link: https://lore.kernel.org/r/35fa32a019361ec26265c8a789ee31e448d4dbda.1772505399.git.zhuhui@kylinos.cn Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent 437350d commit a8fce02

File tree

3 files changed

+0
-31
lines changed

3 files changed

+0
-31
lines changed

tools/testing/selftests/bpf/cgroup_iter_memcg.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ struct memcg_query {
99
unsigned long nr_shmem;
1010
unsigned long nr_file_pages;
1111
unsigned long nr_file_mapped;
12-
/* some memcg_stat_item */
13-
unsigned long memcg_kmem;
1412
/* some vm_event_item */
1513
unsigned long pgfault;
1614
};

tools/testing/selftests/bpf/prog_tests/cgroup_iter_memcg.c

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -126,32 +126,6 @@ static void test_shmem(struct bpf_link *link, struct memcg_query *memcg_query)
126126
shm_unlink("/tmp_shmem");
127127
}
128128

129-
#define NR_PIPES 64
130-
static void test_kmem(struct bpf_link *link, struct memcg_query *memcg_query)
131-
{
132-
int fds[NR_PIPES][2], i;
133-
134-
/*
135-
* Increase kmem value by creating pipes which will allocate some
136-
* kernel buffers.
137-
*/
138-
for (i = 0; i < NR_PIPES; i++) {
139-
if (!ASSERT_OK(pipe(fds[i]), "pipe"))
140-
goto cleanup;
141-
}
142-
143-
if (!ASSERT_OK(read_stats(link), "read stats"))
144-
goto cleanup;
145-
146-
ASSERT_GT(memcg_query->memcg_kmem, 0, "kmem value");
147-
148-
cleanup:
149-
for (i = i - 1; i >= 0; i--) {
150-
close(fds[i][0]);
151-
close(fds[i][1]);
152-
}
153-
}
154-
155129
static void test_pgfault(struct bpf_link *link, struct memcg_query *memcg_query)
156130
{
157131
void *map;
@@ -209,8 +183,6 @@ void test_cgroup_iter_memcg(void)
209183
test_shmem(link, &skel->data_query->memcg_query);
210184
if (test__start_subtest("cgroup_iter_memcg__file"))
211185
test_file(link, &skel->data_query->memcg_query);
212-
if (test__start_subtest("cgroup_iter_memcg__kmem"))
213-
test_kmem(link, &skel->data_query->memcg_query);
214186
if (test__start_subtest("cgroup_iter_memcg__pgfault"))
215187
test_pgfault(link, &skel->data_query->memcg_query);
216188

tools/testing/selftests/bpf/progs/cgroup_iter_memcg.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ int cgroup_memcg_query(struct bpf_iter__cgroup *ctx)
3030
memcg_query.nr_shmem = bpf_mem_cgroup_page_state(memcg, NR_SHMEM);
3131
memcg_query.nr_file_pages = bpf_mem_cgroup_page_state(memcg, NR_FILE_PAGES);
3232
memcg_query.nr_file_mapped = bpf_mem_cgroup_page_state(memcg, NR_FILE_MAPPED);
33-
memcg_query.memcg_kmem = bpf_mem_cgroup_page_state(memcg, MEMCG_KMEM);
3433
memcg_query.pgfault = bpf_mem_cgroup_vm_events(memcg, PGFAULT);
3534

3635
bpf_put_mem_cgroup(memcg);

0 commit comments

Comments
 (0)