All of lore.kernel.org
 help / color / mirror / Atom feed
From: "JP Kobryn (Meta)" <jp.kobryn@linux.dev>
To: Hui Zhu <hui.zhu@linux.dev>, Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>, Shuah Khan <shuah@kernel.org>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	bpf@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: Hui Zhu <zhuhui@kylinos.cn>
Subject: Re: [PATCH bpf-next v4 1/3] selftests/bpf: Remove kmem subtest from cgroup_iter_memcg
Date: Mon, 2 Mar 2026 10:08:12 -0800	[thread overview]
Message-ID: <c28a79b5-2d9c-4ba9-8d78-384bbc0c05de@linux.dev> (raw)
In-Reply-To: <bb9c8fe74aba9dc8c3d803ea6caf6610e981d79a.1772270591.git.zhuhui@kylinos.cn>

On 2/28/26 1:25 AM, Hui Zhu wrote:
> From: Hui Zhu <zhuhui@kylinos.cn>
> 
> 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.
> 
> Signed-off-by: Hui Zhu <zhuhui@kylinos.cn>
> ---
>   .../testing/selftests/bpf/cgroup_iter_memcg.h |  2 --
>   .../bpf/prog_tests/cgroup_iter_memcg.c        | 28 -------------------
>   .../selftests/bpf/progs/cgroup_iter_memcg.c   |  1 -
>   3 files changed, 31 deletions(-)
> 
> diff --git a/tools/testing/selftests/bpf/cgroup_iter_memcg.h b/tools/testing/selftests/bpf/cgroup_iter_memcg.h
> index 3f59b127943b..ff20ec537164 100644
> --- a/tools/testing/selftests/bpf/cgroup_iter_memcg.h
> +++ b/tools/testing/selftests/bpf/cgroup_iter_memcg.h
> @@ -9,8 +9,6 @@ struct memcg_query {
>   	unsigned long nr_shmem;
>   	unsigned long nr_file_pages;
>   	unsigned long nr_file_mapped;
> -	/* some memcg_stat_item */
> -	unsigned long memcg_kmem;
>   	/* some vm_event_item */
>   	unsigned long pgfault;
>   };
> diff --git a/tools/testing/selftests/bpf/prog_tests/cgroup_iter_memcg.c b/tools/testing/selftests/bpf/prog_tests/cgroup_iter_memcg.c
> index a5afd16705f0..88fc3e83d2b7 100644
> --- a/tools/testing/selftests/bpf/prog_tests/cgroup_iter_memcg.c
> +++ b/tools/testing/selftests/bpf/prog_tests/cgroup_iter_memcg.c
> @@ -126,32 +126,6 @@ static void test_shmem(struct bpf_link *link, struct memcg_query *memcg_query)
>   	shm_unlink("/tmp_shmem");
>   }
>   
> -#define NR_PIPES 64
> -static void test_kmem(struct bpf_link *link, struct memcg_query *memcg_query)
> -{
> -	int fds[NR_PIPES][2], i;
> -
> -	/*
> -	 * Increase kmem value by creating pipes which will allocate some
> -	 * kernel buffers.
> -	 */
> -	for (i = 0; i < NR_PIPES; i++) {
> -		if (!ASSERT_OK(pipe(fds[i]), "pipe"))
> -			goto cleanup;
> -	}
> -
> -	if (!ASSERT_OK(read_stats(link), "read stats"))
> -		goto cleanup;
> -
> -	ASSERT_GT(memcg_query->memcg_kmem, 0, "kmem value");
> -
> -cleanup:
> -	for (i = i - 1; i >= 0; i--) {
> -		close(fds[i][0]);
> -		close(fds[i][1]);
> -	}
> -}
> -
>   static void test_pgfault(struct bpf_link *link, struct memcg_query *memcg_query)
>   {
>   	void *map;
> @@ -209,8 +183,6 @@ void test_cgroup_iter_memcg(void)
>   		test_shmem(link, &skel->data_query->memcg_query);
>   	if (test__start_subtest("cgroup_iter_memcg__file"))
>   		test_file(link, &skel->data_query->memcg_query);
> -	if (test__start_subtest("cgroup_iter_memcg__kmem"))
> -		test_kmem(link, &skel->data_query->memcg_query);
>   	if (test__start_subtest("cgroup_iter_memcg__pgfault"))
>   		test_pgfault(link, &skel->data_query->memcg_query);
>   
> diff --git a/tools/testing/selftests/bpf/progs/cgroup_iter_memcg.c b/tools/testing/selftests/bpf/progs/cgroup_iter_memcg.c
> index 59fb70a3cc50..12f79a44133e 100644
> --- a/tools/testing/selftests/bpf/progs/cgroup_iter_memcg.c
> +++ b/tools/testing/selftests/bpf/progs/cgroup_iter_memcg.c
> @@ -30,7 +30,6 @@ int cgroup_memcg_query(struct bpf_iter__cgroup *ctx)
>   	memcg_query.nr_shmem = bpf_mem_cgroup_page_state(memcg, NR_SHMEM);
>   	memcg_query.nr_file_pages = bpf_mem_cgroup_page_state(memcg, NR_FILE_PAGES);
>   	memcg_query.nr_file_mapped = bpf_mem_cgroup_page_state(memcg, NR_FILE_MAPPED);
> -	memcg_query.memcg_kmem = bpf_mem_cgroup_page_state(memcg, MEMCG_KMEM);
>   	memcg_query.pgfault = bpf_mem_cgroup_vm_events(memcg, PGFAULT);
>   
>   	bpf_put_mem_cgroup(memcg);

Reviewed-by: JP Kobryn <jp.kobryn@linux.dev>

  reply	other threads:[~2026-03-02 18:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-28  9:25 [PATCH bpf-next v4 0/3] Fix test_cgroup_iter_memcg issues found during back-porting Hui Zhu
2026-02-28  9:25 ` [PATCH bpf-next v4 1/3] selftests/bpf: Remove kmem subtest from cgroup_iter_memcg Hui Zhu
2026-03-02 18:08   ` JP Kobryn (Meta) [this message]
2026-02-28  9:25 ` [PATCH bpf-next v4 2/3] bpf: Use bpf_core_enum_value for stats in cgroup_iter_memcg Hui Zhu
2026-03-02 18:10   ` JP Kobryn (Meta)
2026-02-28  9:25 ` [PATCH bpf-next v4 3/3] selftests/bpf: Check bpf_mem_cgroup_page_state return value Hui Zhu
2026-03-02 18:27   ` JP Kobryn (Meta)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c28a79b5-2d9c-4ba9-8d78-384bbc0c05de@linux.dev \
    --to=jp.kobryn@linux.dev \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=hui.zhu@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=roman.gushchin@linux.dev \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    --cc=zhuhui@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.