From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98620C433EF for ; Tue, 10 May 2022 18:25:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348177AbiEJS33 (ORCPT ); Tue, 10 May 2022 14:29:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236729AbiEJS3Y (ORCPT ); Tue, 10 May 2022 14:29:24 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AD362A76B4 for ; Tue, 10 May 2022 11:25:26 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id d5so24974748wrb.6 for ; Tue, 10 May 2022 11:25:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=i/K+z4FbavDUp9taCkfXpbx13rVcW3GTSvwjLfREXAU=; b=Tty5wMz7Ghu646JswlNLX+XwgMjXTrtdIAnTGLzWswd7pJqjghhee9uTTrSBkA1mS5 TASpWLvrSWJ0o/VmKB1zZ2EKL7bj0qTC3lvVRuamF3i9rZ6kaQX5QDmWCn9TRCB5uXkV r8gOHaTXenDSj1D57niaR5CpxS9xrrcL40YA8vpjqNI+g1gL5pCdsCqYcSLce1I6fc3z kWNzuDcKIBDb+SwqrxV9F0c+DchRf6wXrjkpR+hTKigiASG8TQ/T4toShl24UGOGYEeY ZEnNjV6vVbfPH9Mde3cglN60wQIz6IJ5FIeBa8eN2oVUv11BpQol0cmvcrU6FhcjdmJZ DX4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=i/K+z4FbavDUp9taCkfXpbx13rVcW3GTSvwjLfREXAU=; b=5z9SmtLRslT6/RDcnMmxFZZh6SQ27vxizL0jkDGsInCXaDYycSYbfmyhyM2m6FXNyd Y9FWxBXyW0TeJCv7h1FzV0+2Ni06iem3MX5nz+MECtI+drDPjeZthTYMWit4zvhq4VAn 9oz96Umv+tSqYXDXrOGoiW1ilXicH/Nl6tcnLVaU7q/Do2s9/Fu0gVji5e3pIXAtz3SC vjtko5FaSPNwFsNdH5ifLDinEsr+z8CsgYuPW1GHmr7iPJRLsRRGr1Rob6ohcZZpwQr1 01RfYQ3BLiFVp/3yjS1EItZd5Xz7xv5hoMyxZfgyfagAJWsEtKzNY9G+zxraoVH6gblP ePGw== X-Gm-Message-State: AOAM533MI/Jr+uOUFXcwfJ51Tb/bS43KQEKtyB4tRmJLbNQCUsREbLgC wu13TywlrxWCqUvB4VsNbPwdAJs0EXK/Yy6yg8IP6w== X-Google-Smtp-Source: ABdhPJyzA6ZqMl9aS9nV7QUKqV1oRP2aghQEHWBX7a2slUyqZ51MHrel4plITu1M0/TnH8bx25zFuopsJMSrkMAFd0g= X-Received: by 2002:a5d:630d:0:b0:20a:e1a3:8018 with SMTP id i13-20020a5d630d000000b0020ae1a38018mr19695063wru.489.1652207124680; Tue, 10 May 2022 11:25:24 -0700 (PDT) MIME-Version: 1.0 References: <20220510001807.4132027-1-yosryahmed@google.com> <20220510001807.4132027-9-yosryahmed@google.com> In-Reply-To: <20220510001807.4132027-9-yosryahmed@google.com> From: Hao Luo Date: Tue, 10 May 2022 11:25:13 -0700 Message-ID: Subject: Re: [RFC PATCH bpf-next 8/9] bpf: Introduce cgroup iter To: Yosry Ahmed Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Tejun Heo , Zefan Li , Johannes Weiner , Shuah Khan , Roman Gushchin , Michal Hocko , Stanislav Fomichev , David Rientjes , Greg Thelen , Shakeel Butt , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, cgroups@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 9, 2022 at 5:18 PM Yosry Ahmed wrote: > > From: Hao Luo > > Introduce a new type of iter prog: cgroup. Unlike other bpf_iter, this > iter doesn't iterate a set of kernel objects. Instead, it is supposed to > be parameterized by a cgroup id and prints only that cgroup. So one > needs to specify a target cgroup id when attaching this iter. The target > cgroup's state can be read out via a link of this iter. > > Signed-off-by: Hao Luo > Signed-off-by: Yosry Ahmed > --- > include/linux/bpf.h | 2 + > include/uapi/linux/bpf.h | 6 ++ > kernel/bpf/Makefile | 2 +- > kernel/bpf/cgroup_iter.c | 148 +++++++++++++++++++++++++++++++++ > tools/include/uapi/linux/bpf.h | 6 ++ > 5 files changed, 163 insertions(+), 1 deletion(-) > create mode 100644 kernel/bpf/cgroup_iter.c > Thanks Yosry for posting this patch! Dear reviewers, this is v2 of the cgroup_iter change I sent previously at https://lore.kernel.org/bpf/20220225234339.2386398-9-haoluo@google.com/ v1 - > v2: - Getting the cgroup's reference at the time at attaching, instead of at the time when iterating. (Yonghong) (context [1]) - Remove .init_seq_private and .fini_seq_private callbacks for cgroup_iter. They are not needed now. (Yonghong) [1] https://lore.kernel.org/bpf/f780fc3a-dbc2-986c-d5a0-6b0ef1c4311f@fb.com/ Hao