public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: "T.J. Mercier" <tjmercier@google.com>
Cc: 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>, Mykola Lysenko <mykolal@fb.com>,
	Shuah Khan <shuah@kernel.org>,
	bpf@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selftests/bpf: Fix kmem_cache iterator draining
Date: Mon, 28 Apr 2025 13:06:25 -0700	[thread overview]
Message-ID: <aA_fwbubEEDjolYX@google.com> (raw)
In-Reply-To: <20250428180256.1482899-1-tjmercier@google.com>

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@google.com>

Oops, thanks for fixing this.

Acked-by: Namhyung Kim <namhyung@kernel.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
> 

  parent reply	other threads:[~2025-04-28 20:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-28 18:02 [PATCH] selftests/bpf: Fix kmem_cache iterator draining T.J. Mercier
2025-04-28 18:16 ` Song Liu
2025-04-28 20:06 ` Namhyung Kim [this message]
2025-04-29  3:00   ` T.J. Mercier
2025-04-29 20:40 ` patchwork-bot+netdevbpf

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=aA_fwbubEEDjolYX@google.com \
    --to=namhyung@kernel.org \
    --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=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=mykolal@fb.com \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=tjmercier@google.com \
    --cc=yonghong.song@linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox