Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2579121rwi; Tue, 11 Oct 2022 10:26:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4oXVxZz2qsLYAZuHWoLL1HNnPxYSLSFMi3kdsoQR0jW0xHMNmoCNbdvSqMr1mZ/TOvkMcv X-Received: by 2002:a17:907:6296:b0:787:d066:9fcf with SMTP id nd22-20020a170907629600b00787d0669fcfmr18781932ejc.692.1665509206235; Tue, 11 Oct 2022 10:26:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665509206; cv=none; d=google.com; s=arc-20160816; b=fxvAxRua9teI/8Mzy6Ylex3Wn0K2tdrBkPXBeHoDmyUyxgq/NmubrCS2mOMBS4KcDt NX0SmbqDUgdU8KpjeG/ZqfB3POdyob8j8SvJKyZ1xFZGG5iGWtwQeDAdiBR9YpOO2lHz 07nDAOSelRH9mxEpyY5/qQMqcmZYfEAatyTgi16QY0qXmieL4iWY5lSfakQrQrLwDF+N OS8hn8KnYheeVbF3oI14aU6jqHMg3wsWOGYEgIWSAIv7V694OxxKCY0lYZFZ3nu/vmPe 8sL/DX0slZQuQ30+S2AvOV55HLdPAICrnbHd4tVHzuUchgB6ZOAd35hN1MJzrzVop8Ta 2t7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:mime-version:date :dkim-signature:message-id; bh=fSpHFQ/t+wVXLc+3hNEAK/z5TCpUZCMKJcQhLnBO7pA=; b=GWlC9zZ86TWDMnUYAVFKrMSgj4izRf6qX4c/LiGHim7u1QZ8y0B4F0czlfuSuJPB4G C4MptEJjQrusuH8ZoyPNbQMpIMgXyiAMvuy4mv0oWGqxnLmk8yFluTAFB58zY9Qu2HXO 0lNdkVYCLP3LYPT7POEPiL6FvJlDWa0HQY2AD1He/V2QonuOOxTLqenwPKPmWjUkEtZl 9oU3lcIwR2IdRkopzIbjzOe8Tjeo5cguGTcTO1CtowWwHXZqaYE0F/qh09e5g/wluU+/ bLiLFn7woThKljHQ6zoF/9s5hHMKtfRLEMBwXCEb6MVRRenf8IqM3/YuGuYPtY1v6N3A m3bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=VZXczMB1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hr9-20020a1709073f8900b007832270e88fsi12302495ejc.681.2022.10.11.10.26.20; Tue, 11 Oct 2022 10:26:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=VZXczMB1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229698AbiJKQqt (ORCPT + 99 others); Tue, 11 Oct 2022 12:46:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229511AbiJKQqk (ORCPT ); Tue, 11 Oct 2022 12:46:40 -0400 Received: from out2.migadu.com (out2.migadu.com [188.165.223.204]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C174A572E; Tue, 11 Oct 2022 09:46:34 -0700 (PDT) Message-ID: <2ba0ee79-2e7e-6807-3312-1a2c5ef3bae0@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1665506792; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fSpHFQ/t+wVXLc+3hNEAK/z5TCpUZCMKJcQhLnBO7pA=; b=VZXczMB1/0cXDlJrV4Hl9sjqWKt4jiyPljBV9WZxUvzdbwjoKUqh1lDfvqbGk8Z/cPGbuU VrlszEalWaKYs9+1ekJ60k4dB7wYy6bqb7n9IIKJ3baP+C7ioDlkDKwAQWkwmQEmMU0mZB JamUEiyRsoy6dCO7N4Vlwh+lNYYHkwM= Date: Tue, 11 Oct 2022 09:46:27 -0700 MIME-Version: 1.0 Subject: Re: [PATCH v2 2/2] bpf: cgroup_iter: support cgroup1 using cgroup fd Content-Language: en-US To: Yosry Ahmed , Tejun Heo Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Zefan Li , Johannes Weiner , Yonghong Song , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Song Liu , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa References: <20221011003359.3475263-1-yosryahmed@google.com> <20221011003359.3475263-3-yosryahmed@google.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Martin KaFai Lau In-Reply-To: <20221011003359.3475263-3-yosryahmed@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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 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. */