[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aA_fwbubEEDjolYX@google.com>
Date: Mon, 28 Apr 2025 13:06:25 -0700
From: Namhyung Kim <namhyung@...nel.org>
To: "T.J. Mercier" <tjmercier@...gle.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>,
Eduard Zingerman <eddyz87@...il.com>, Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>, Stanislav Fomichev <sdf@...ichev.me>,
Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
Mykola Lysenko <mykolal@...com>, Shuah Khan <shuah@...nel.org>,
bpf@...r.kernel.org, linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] selftests/bpf: Fix kmem_cache iterator draining
Hello,
On Mon, Apr 28, 2025 at 06:02:54PM +0000, T.J. Mercier wrote:
> The closing parentheses around the read syscall is misplaced, causing
> single byte reads from the iterator instead of buf sized reads. While
> the end result is the same, many more read calls than necessary are
> performed.
>
> $ tools/testing/selftests/bpf/vmtest.sh "./test_progs -t kmem_cache_iter"
> 145/1 kmem_cache_iter/check_task_struct:OK
> 145/2 kmem_cache_iter/check_slabinfo:OK
> 145/3 kmem_cache_iter/open_coded_iter:OK
> 145 kmem_cache_iter:OK
> Summary: 1/3 PASSED, 0 SKIPPED, 0 FAILED
>
> Fixes: a496d0cdc84d ("selftests/bpf: Add a test for kmem_cache_iter")
> Signed-off-by: T.J. Mercier <tjmercier@...gle.com>
Oops, thanks for fixing this.
Acked-by: Namhyung Kim <namhyung@...nel.org>
Thanks,
Namhyung
> ---
> tools/testing/selftests/bpf/prog_tests/kmem_cache_iter.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/kmem_cache_iter.c b/tools/testing/selftests/bpf/prog_tests/kmem_cache_iter.c
> index 8e13a3416a21..1de14b111931 100644
> --- a/tools/testing/selftests/bpf/prog_tests/kmem_cache_iter.c
> +++ b/tools/testing/selftests/bpf/prog_tests/kmem_cache_iter.c
> @@ -104,7 +104,7 @@ void test_kmem_cache_iter(void)
> goto destroy;
>
> memset(buf, 0, sizeof(buf));
> - while (read(iter_fd, buf, sizeof(buf) > 0)) {
> + while (read(iter_fd, buf, sizeof(buf)) > 0) {
> /* Read out all contents */
> printf("%s", buf);
> }
>
> base-commit: b4432656b36e5cc1d50a1f2dc15357543add530e
> --
> 2.49.0.906.g1f30a19c02-goog
>
Powered by blists - more mailing lists