From: bot+bpf-ci@kernel.org
To: cui.tao@linux.dev,tj@kernel.org,josef@toxicopanda.com,axboe@kernel.dk,alexei.starovoitov@gmail.com
Cc: cgroups@vger.kernel.org,linux-block@vger.kernel.org,linux-kernel@vger.kernel.org,bpf@vger.kernel.org,andrii@kernel.org,eddyz87@gmail.com,ast@kernel.org,daniel@iogearbox.net,linux-kselftest@vger.kernel.org,cui.tao@linux.dev,cuitao@kylinos.cn,ameryhung@gmail.com,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mason@kernel.org,ihor.solodrai@linux.dev
Subject: Re: [RFC PATCH v12 3/4] selftests/bpf: add iocost cost model test
Date: Tue, 3 Nov 2026 14:07:39 +0000 (UTC) [thread overview]
Message-ID: <cdb4a70a69306fb920d52c3e5511bb1cbac094d4f47b1b89ae56b674853c287d@mail.kernel.org> (raw)
In-Reply-To: <20261103132613.1952975-4-cui.tao@linux.dev>
[-- Attachment #1: Type: text/plain, Size: 2747 bytes --]
> selftests/bpf: add iocost cost model test
TL;DR: Selftest cgroup names "iocost_pairing" and "iocost_ms" lack a leading
'/', so the cgroups are likely created outside the work directory and not
removed by cleanup_cgroup_environment(), leaving empty cgroups on the host.
> diff --git a/tools/testing/selftests/bpf/prog_tests/iocost_model.c b/tools/testing/selftests/bpf/prog_tests/iocost_model.c
> new file mode 100644
[ ... ]
> + /*
> + * cgroup_setup_and_join() creates the priced-IO cgroup with the
> + * available controllers enabled, so the cgroup has
> + * io.weight/io.stat and the iocg activates.
> + * cleanup_cgroup_environment() removes it from every exit path
> + * below. io.cost.qos and io.cost.model are root-only cgroupfs
> + * files: they are written at the hierarchy root and reverted on
> + * exit.
> + */
> + cg = cgroup_setup_and_join("iocost_pairing");
[ ... ]
> + cg = cgroup_setup_and_join("iocost_ms");
Will these cgroups actually be removed by cleanup_cgroup_environment()?
The name has no leading '/', and format_cgroup_path() in cgroup_helpers.c
joins the pieces with no separator:
#define format_cgroup_path_pid(buf, path, pid) \
snprintf(buf, sizeof(buf), "%s%s%d%s", CGROUP_MOUNT_PATH, \
CGROUP_WORK_DIR, pid, path)
So cgroup_setup_and_join("iocost_pairing") ends up doing mkdir on
"/mnt/cgroup-test-work-dir<pid>iocost_pairing". That is a sibling of the
work directory directly under the cgroup2 root, not a child of it.
join_cgroup(), write_cgroup_file() and read_cgroup_file() build the same
path, so the test itself works.
But __cleanup_cgroup_environment() only walks the work directory:
format_cgroup_path(cgroup_workdir, "");
join_cgroup_from_top(CGROUP_MOUNT_PATH);
nftw(cgroup_workdir, nftwfunc, WALK_FD_LIMIT, FTW_DEPTH | FTW_MOUNT);
so the sibling directory is never visited. The empty cgroup remains on the
host as /sys/fs/cgroup/cgroup-test-work-dir<pid>iocost_pairing, which also
contradicts the comment above ("cleanup_cgroup_environment() removes it from
every exit path below"). serial_test_iocost_model_streams() has the same
problem with "iocost_ms", including the matching write_cgroup_file() and
read_cost_usage() calls.
Other callers that use a fixed name pass a leading slash, for example
"/skb_cgroup_test" and "/cgroup_iter_memcg_test". Would "/iocost_pairing"
and "/iocost_ms" at every place they are passed put the cgroups under the
work directory where the existing cleanup removes them?
---
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/41646836440
next prev parent reply other threads:[~2026-11-03 14:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 13:26 [RFC PATCH v12 0/4] blk-iocost: BPF struct_ops cost model Tao Cui
2026-11-03 13:26 ` [RFC PATCH v12 1/4] blk-iocost: add BPF struct_ops cost model support Tao Cui
2026-11-03 16:51 ` Alexei Starovoitov
2026-11-03 13:26 ` [RFC PATCH v12 2/4] blk-iocost: add iocost_ioc_tick tracepoint for per-period device summary Tao Cui
2026-11-03 14:07 ` bot+bpf-ci
2026-11-03 13:26 ` [RFC PATCH v12 3/4] selftests/bpf: add iocost cost model test Tao Cui
2026-11-03 14:07 ` bot+bpf-ci [this message]
2026-11-03 13:26 ` [RFC PATCH v12 4/4] docs: cgroup-v2: document the iocost BPF cost model attachment Tao Cui
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=cdb4a70a69306fb920d52c3e5511bb1cbac094d4f47b1b89ae56b674853c287d@mail.kernel.org \
--to=bot+bpf-ci@kernel.org \
--cc=alexei.starovoitov@gmail.com \
--cc=ameryhung@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=axboe@kernel.dk \
--cc=bpf@vger.kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=cui.tao@linux.dev \
--cc=cuitao@kylinos.cn \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=ihor.solodrai@linux.dev \
--cc=josef@toxicopanda.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@kernel.org \
--cc=mason@kernel.org \
--cc=tj@kernel.org \
--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
all inboxes | Powered by JetHome®