Re: [PATCH bpf-next v3 2/2] selftests/bpf: add memcg async reclaim test

From: bot+bpf-ci

Date: Wed Aug 19 2026 - 03:22:51 EST


> diff --git a/tools/testing/selftests/bpf/prog_tests/memcg_async_reclaim.c b/tools/testing/selftests/bpf/prog_tests/memcg_async_reclaim.c
> new file mode 100644
> index 000000000000..e990d1fdc79f
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/memcg_async_reclaim.c

[ ... ]

> +static int
> +run_high_low_workload(double *high_elapsed, double *low_elapsed, int read_times)
> +{
> + char high_data_file[PATH_MAX];
> + char low_data_file[PATH_MAX];
> + char high_time_file[PATH_MAX];
> + char low_time_file[PATH_MAX];
> + const char *dir = workload_files_dir();
> + pid_t high_pid = -1, low_pid = -1;
> + int fd, status;
> + int ret = -1;

[ ... ]

> + low_pid = fork();
> + if (!ASSERT_GE(low_pid, 0, "fork low"))
> + goto cleanup;
> + if (low_pid == 0)
> + exit(real_test_child_work(CG_LOW_DIR, low_data_file,
> + low_time_file, read_times));
> +
> + high_pid = fork();
> + if (!ASSERT_GE(high_pid, 0, "fork high"))
> + goto cleanup;
> + if (high_pid == 0)
> + exit(real_test_child_work(CG_HIGH_DIR, high_data_file,
> + high_time_file, read_times));

Should these forked children use _exit() rather than exit()?

exit() runs atexit handlers and flushes every stdio stream the child
inherited from test_progs, including whatever the parent had buffered but
not yet written at the moment of the fork. Where the buffer is a real file
descriptor this duplicates the parent's pending output once per child.

The hijack body in test_progs.c is inside #ifdef __GLIBC__, so on a
non-glibc build stdout is never hijacked at all. Also, stdio_hijack_init()
is skipped when running with verbose output:

if (verbose() && env.worker_id == -1)
return; /* output to stdout by default */

So `./test_progs -v > log` (fully buffered pipe/file, no -j) and any
musl-based build get duplicated log fragments plus the child's own printf.

Other forking tests in this directory already use _exit():
prog_tests/bpf_iter.c, prog_tests/exhandler.c, prog_tests/cpumask.c,
prog_tests/task_kfunc.c, prog_tests/deny_namespace.c, and
prog_tests/uprobe_syscall.c.

[ ... ]


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/32224943030