public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jerome Marchand" <jmarchan@redhat.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH] selftests/bpf: Page out as late a possible in file_reader
Date: Mon, 20 Apr 2026 23:13:27 +0000	[thread overview]
Message-ID: <20260420231328.68FC7C19425@smtp.kernel.org> (raw)
In-Reply-To: <20260420134637.2513867-1-jmarchan@redhat.com>

Sashiko AI review found 1 potential issue(s):
- [Low] The newly promoted global variable `addr` is declared without the `static` keyword, polluting the global namespace.
--

commit e2c581de007abac2e6985b4f49f6c9786c3263b0
Author: Jerome Marchand <jmarchan@redhat.com>

selftests/bpf: Page out as late a possible in file_reader

The file_reader/on_open_expect_fault fails consistently on my system.
This commit moves the call to madvise(MADV_PAGEOUT) to just before
attaching the program to minimize the risk of having those pages pulled
back in.

> diff --git a/tools/testing/selftests/bpf/prog_tests/file_reader.c b/tools/testing/selftests/bpf/prog_tests/file_reader.c
> index 5cde32b35da44..48aae7ea0e4bb 100644
> --- a/tools/testing/selftests/bpf/prog_tests/file_reader.c
> +++ b/tools/testing/selftests/bpf/prog_tests/file_reader.c
> @@ -10,6 +10,7 @@
>  
>  const char *user_ptr = "hello world";
>  char file_contents[256000];
> +void *addr;

This isn't a bug, but BPF selftests link all prog_tests/*.c files together
into a single test_progs executable.

Since modern compilers use -fno-common by default, could this un-prefixed
global variable cause a multiple definition linker error if another test
introduces a global variable with the same name?

Should addr be declared as static to safely restrict its linkage to
file_reader.c?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260420134637.2513867-1-jmarchan@redhat.com?part=1

  parent reply	other threads:[~2026-04-20 23:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-20 13:46 [PATCH] selftests/bpf: Page out as late a possible in file_reader Jerome Marchand
2026-04-20 16:52 ` Mykyta Yatsenko
2026-04-21  5:59   ` Jerome Marchand
2026-04-20 23:13 ` sashiko-bot [this message]
2026-04-21 10:52 ` Jiri Olsa

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=20260420231328.68FC7C19425@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=jmarchan@redhat.com \
    --cc=sashiko@lists.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