2022-08-25 22:13:30

by Hao Luo

[permalink] [raw]
Subject: [PATCH bpf-next 0/2] Add CGROUP prefix to cgroup_iter_order

As suggested by Andrii, add 'CGROUP' to cgroup_iter_order. This fix is
divided into two patches. Patch 1/2 fixes the commit that introduced
cgroup_iter. Patch 2/2 fixes the selftest that uses the
cgroup_iter_order. This is because the selftest was introduced in a
different commit. I tested this patchset via the following command:

test_progs -t cgroup,iter,btf_dump

Hao Luo (2):
bpf: Add CGROUP to cgroup_iter order
selftests/bpf: Fix test that uses cgroup_iter order

include/uapi/linux/bpf.h | 10 +++---
kernel/bpf/cgroup_iter.c | 32 +++++++++----------
tools/include/uapi/linux/bpf.h | 10 +++---
.../selftests/bpf/prog_tests/btf_dump.c | 2 +-
.../prog_tests/cgroup_hierarchical_stats.c | 2 +-
.../selftests/bpf/prog_tests/cgroup_iter.c | 10 +++---
6 files changed, 33 insertions(+), 33 deletions(-)

--
2.37.2.672.g94769d06f0-goog


2022-08-25 22:18:55

by Hao Luo

[permalink] [raw]
Subject: [PATCH bpf-next 2/2] selftests/bpf: Fix test that uses cgroup_iter order

Previous commit added a CGROUP prefix to the bpf_cgroup_iter_order.
It fixes the commit that introduced cgroup iter. This commit fixes
the selftest that uses the cgroup_iter_order. Because they fix two
different commits, so put them in separate patches.

Fixes: 88886309d2e8 ("selftests/bpf: add a selftest for cgroup hierarchical stats collection")
Suggested-by: Andrii Nakryiko <[email protected]>
Signed-off-by: Hao Luo <[email protected]>
---
.../selftests/bpf/prog_tests/cgroup_hierarchical_stats.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/cgroup_hierarchical_stats.c b/tools/testing/selftests/bpf/prog_tests/cgroup_hierarchical_stats.c
index 101a6d70b863..bed1661596f7 100644
--- a/tools/testing/selftests/bpf/prog_tests/cgroup_hierarchical_stats.c
+++ b/tools/testing/selftests/bpf/prog_tests/cgroup_hierarchical_stats.c
@@ -275,7 +275,7 @@ static int setup_cgroup_iter(struct cgroup_hierarchical_stats *obj,
* traverse one cgroup, so set the traversal order to "self".
*/
linfo.cgroup.cgroup_fd = cgroup_fd;
- linfo.cgroup.order = BPF_ITER_SELF_ONLY;
+ linfo.cgroup.order = BPF_CGROUP_ITER_SELF_ONLY;
opts.link_info = &linfo;
opts.link_info_len = sizeof(linfo);
link = bpf_program__attach_iter(obj->progs.dump_vmscan, &opts);
--
2.37.2.672.g94769d06f0-goog

2022-08-26 02:37:39

by Yosry Ahmed

[permalink] [raw]
Subject: Re: [PATCH bpf-next 0/2] Add CGROUP prefix to cgroup_iter_order

On Thu, Aug 25, 2022 at 7:03 PM Andrii Nakryiko
<[email protected]> wrote:
>
> On Thu, Aug 25, 2022 at 4:20 PM Yosry Ahmed <[email protected]> wrote:
> >
> > On Thu, Aug 25, 2022 at 2:56 PM Andrii Nakryiko
> > <[email protected]> wrote:
> > >
> > > On Thu, Aug 25, 2022 at 2:39 PM Hao Luo <[email protected]> wrote:
> > > >
> > > > As suggested by Andrii, add 'CGROUP' to cgroup_iter_order. This fix is
> > > > divided into two patches. Patch 1/2 fixes the commit that introduced
> > > > cgroup_iter. Patch 2/2 fixes the selftest that uses the
> > > > cgroup_iter_order. This is because the selftest was introduced in a
> > >
> > > but if you split rename into two patches, you break selftests build
> > > and thus potentially bisectability of selftests regressions. So I
> > > think you have to keep both in the same patch.
> >
> > I thought fixes to commits still in bpf-next would get squashed. Would
> > you mind elaborating why we don't do this?
> >
>
> We don't amend follow up fixes into original commits and preserve history.

Got it. Thanks Andrii.

>
> > >
> > > With that:
> > >
> > > Acked-by: Andrii Nakryiko <[email protected]>
> > >
> > > > different commit. I tested this patchset via the following command:
> > > >
> > > > test_progs -t cgroup,iter,btf_dump
> > > >
> > > > Hao Luo (2):
> > > > bpf: Add CGROUP to cgroup_iter order
> > > > selftests/bpf: Fix test that uses cgroup_iter order
> > > >
> > > > include/uapi/linux/bpf.h | 10 +++---
> > > > kernel/bpf/cgroup_iter.c | 32 +++++++++----------
> > > > tools/include/uapi/linux/bpf.h | 10 +++---
> > > > .../selftests/bpf/prog_tests/btf_dump.c | 2 +-
> > > > .../prog_tests/cgroup_hierarchical_stats.c | 2 +-
> > > > .../selftests/bpf/prog_tests/cgroup_iter.c | 10 +++---
> > > > 6 files changed, 33 insertions(+), 33 deletions(-)
> > > >
> > > > --
> > > > 2.37.2.672.g94769d06f0-goog
> > > >