diff mbox series

[v2,2/2] bpf: cgroup_iter: support cgroup1 using cgroup fd

Message ID 20221011003359.3475263-3-yosryahmed@google.com (mailing list archive)
State Handled Elsewhere
Delegated to: BPF
Headers show
Series Support cgroup1 in get from fd/file interfaces | expand

Checks

Context Check Description
bpf/vmtest-bpf-PR fail merge-conflict
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Yosry Ahmed Oct. 11, 2022, 12:33 a.m. UTC
Use cgroup_v1v2_get_from_fd() in cgroup_iter to support attaching to
both cgroup v1 and v2 using fds.

Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
---
 kernel/bpf/cgroup_iter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Martin KaFai Lau Oct. 11, 2022, 4:46 p.m. UTC | #1
On 10/10/22 5:33 PM, Yosry Ahmed wrote:
> Use cgroup_v1v2_get_from_fd() in cgroup_iter to support attaching to
> both cgroup v1 and v2 using fds.
> 
> Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
> ---
>   kernel/bpf/cgroup_iter.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/bpf/cgroup_iter.c b/kernel/bpf/cgroup_iter.c
> index 0d200a993489..9fcf09f2ef00 100644
> --- a/kernel/bpf/cgroup_iter.c
> +++ b/kernel/bpf/cgroup_iter.c
> @@ -196,7 +196,7 @@ static int bpf_iter_attach_cgroup(struct bpf_prog *prog,
>   		return -EINVAL;
>   
>   	if (fd)
> -		cgrp = cgroup_get_from_fd(fd);
> +		cgrp = cgroup_v1v2_get_from_fd(fd);

Acked-by: Martin KaFai Lau <martin.lau@kernel.org>

Tejun, patch 1 should depend on a recent revert that is not in the bpf tree yet. 
  Do you want to take this set to the cgroup tree?

>   	else if (id)
>   		cgrp = cgroup_get_from_id(id);
>   	else /* walk the entire hierarchy by default. */
Tejun Heo Oct. 11, 2022, 4:49 p.m. UTC | #2
On Tue, Oct 11, 2022 at 09:46:27AM -0700, Martin KaFai Lau wrote:
> On 10/10/22 5:33 PM, Yosry Ahmed wrote:
> > Use cgroup_v1v2_get_from_fd() in cgroup_iter to support attaching to
> > both cgroup v1 and v2 using fds.
> > 
> > Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
> > ---
> >   kernel/bpf/cgroup_iter.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/kernel/bpf/cgroup_iter.c b/kernel/bpf/cgroup_iter.c
> > index 0d200a993489..9fcf09f2ef00 100644
> > --- a/kernel/bpf/cgroup_iter.c
> > +++ b/kernel/bpf/cgroup_iter.c
> > @@ -196,7 +196,7 @@ static int bpf_iter_attach_cgroup(struct bpf_prog *prog,
> >   		return -EINVAL;
> >   	if (fd)
> > -		cgrp = cgroup_get_from_fd(fd);
> > +		cgrp = cgroup_v1v2_get_from_fd(fd);
> 
> Acked-by: Martin KaFai Lau <martin.lau@kernel.org>
> 
> Tejun, patch 1 should depend on a recent revert that is not in the bpf tree
> yet.  Do you want to take this set to the cgroup tree?

Yeah, will do.

Thanks.
diff mbox series

Patch

diff --git a/kernel/bpf/cgroup_iter.c b/kernel/bpf/cgroup_iter.c
index 0d200a993489..9fcf09f2ef00 100644
--- a/kernel/bpf/cgroup_iter.c
+++ b/kernel/bpf/cgroup_iter.c
@@ -196,7 +196,7 @@  static int bpf_iter_attach_cgroup(struct bpf_prog *prog,
 		return -EINVAL;
 
 	if (fd)
-		cgrp = cgroup_get_from_fd(fd);
+		cgrp = cgroup_v1v2_get_from_fd(fd);
 	else if (id)
 		cgrp = cgroup_get_from_id(id);
 	else /* walk the entire hierarchy by default. */