Message ID | 20221122055458.173143-1-void@manifault.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2025336wrr; Mon, 21 Nov 2022 21:59:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf6gSEEPNQQoBEKM/1n2SOK8mOGFPiAplfyJg21zyIpGk7NGV5lFUky2aaDtqT7EpWz+O+qK X-Received: by 2002:aa7:c046:0:b0:461:54f0:f7dc with SMTP id k6-20020aa7c046000000b0046154f0f7dcmr19700204edo.117.1669096753725; Mon, 21 Nov 2022 21:59:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669096753; cv=none; d=google.com; s=arc-20160816; b=uVbyGoh2G8kQTbnERHWDkx1JOswsfbZRh+QkaQEJXfBFdOMvAWpKxp+rALHqKMPjfe yb0K9eZO1ppwZiBt44nl9sRoMQvQUp8sR9J5O0AE0mCQ1q1jU5gAk2dTdeR19zYwPVyj /K5rJlk1DVX07oVoYPqiDOryLQXJXtXfBLxKJNV6DtNI7gRFPk8m/fZZWFhpWvV7J3Tf 8jZoLpLCKQBd5qPhN3bgGoPFTdTzxZXKpV6K/zFkqh/EjdBihF1H35aTp4gQ0M9IJ7gn KkQf5IOE4xocQ86IedO1MCmwxjRkadMJkCaXZANZc+L86jxRz/Ahw6Basms7FNlyyXT4 5A2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=vbC6RWqxQcfi8c8Q+b8E5olDweUU9SSn0fnLj/1TWLc=; b=FMsWL6043Cb1BVzEXGhD//QoZszhSpVVBLgy0hhCQQ3uFePHPt5EjuHr0WO7TUkPeX EXdU5Ri2Hh8UqKetMM9VHdFRj8T/+NopsbQ1TVEgnymCPe1JzWEYpNIHTcRWPCsirOy/ xKWUojc8tFzHw7TE0dNEGfDy5XT6EsylQDRB6wlOmjanvML/rbmsmVwxz/o5HW8Y4d4x xjsJ1vVvAM7P1/iiK+j9rYxir9nHQ3ZXQeKm7sC6XrbxaEpbCIUzn5azvOsxDzgpvdF+ +9eqvHZ4tbsQTDXpCQi+1N9ec463824wnELTZODtA3cCXDAvOzTlzK0IEjfIvVbMyUml jmYA== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hw9-20020a170907a0c900b007330c08fe49si10685518ejc.206.2022.11.21.21.58.49; Mon, 21 Nov 2022 21:59:13 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232090AbiKVF4g (ORCPT <rfc822;cjcooper78@gmail.com> + 99 others); Tue, 22 Nov 2022 00:56:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231655AbiKVF4S (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 22 Nov 2022 00:56:18 -0500 Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B18B2F037; Mon, 21 Nov 2022 21:55:45 -0800 (PST) Received: by mail-qv1-f54.google.com with SMTP id s18so7903679qvo.9; Mon, 21 Nov 2022 21:55:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vbC6RWqxQcfi8c8Q+b8E5olDweUU9SSn0fnLj/1TWLc=; b=GlVo6uk4sWTO+ORiYT8dgsSC27Ry5r99KYrW0cWzvLRHIX3w51o3CECa4fYIj7q/2z RTMYUHLUzgHdkEBLbD5glIQ5w5WWcY4kfm56VQsom4sX/nnbqd3cOyrTl6OWssGycpqC ZxLLAi7JFk18BDFAahJo2A2TOB1O8s7QueyCVjr7jQcZ0tVSmVU1fWsA50PdfuRvxcgf eoJ7stuSVcIdOoyoDJXg4tFZQ4eka+ZIGzLkbeR+3aapMwZy4iMQAOcHMhYiGqDt8uhg 0egbtqruLj1WJI3FUo/a0Ehp2UZ5yTwMHyzt9q5qa7YrC60uN5Q9HXnBD5pOwootSYkj SBwA== X-Gm-Message-State: ANoB5pl8eOeJFPlu67PT0j49kB4HFSO9xx2EdCEq1pXAWRPxGPb63MdT Mg13qbj5H9i59r655dwsPcOkNX1wgbz5Jcrg X-Received: by 2002:ad4:4d53:0:b0:4a0:6e55:e841 with SMTP id m19-20020ad44d53000000b004a06e55e841mr2526445qvm.110.1669096544423; Mon, 21 Nov 2022 21:55:44 -0800 (PST) Received: from localhost ([2620:10d:c091:480::1:3170]) by smtp.gmail.com with ESMTPSA id c23-20020ac85197000000b003a623e5b9ecsm7242619qtn.78.2022.11.21.21.55.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Nov 2022 21:55:43 -0800 (PST) From: David Vernet <void@manifault.com> To: bpf@vger.kernel.org Cc: ast@kernel.org, andrii@kernel.org, daniel@iogearbox.net, martin.lau@linux.dev, yhs@fb.com, song@kernel.org, sdf@google.com, john.fastabend@gmail.com, kpsingh@kernel.org, jolsa@kernel.org, haoluo@google.com, tj@kernel.org, kernel-team@fb.com, linux-kernel@vger.kernel.org Subject: [PATCH bpf-next 0/4] Support storing struct cgroup * objects as kptrs Date: Mon, 21 Nov 2022 23:54:54 -0600 Message-Id: <20221122055458.173143-1-void@manifault.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750174797781129879?= X-GMAIL-MSGID: =?utf-8?q?1750174797781129879?= |
Series |
Support storing struct cgroup * objects as kptrs
|
|
Message
David Vernet
Nov. 22, 2022, 5:54 a.m. UTC
In [0], we added support for storing struct task_struct * objects as kptrs. This patch set extends this effort to also include storing struct cgroup * object as kptrs. As with tasks, there are many possible use cases for storing cgroups in maps. During tracing, for example, it could be useful to query cgroup statistics such as PSI averages, or tracking which tasks are migrating to and from the cgroup. [0]: https://lore.kernel.org/all/20221120051004.3605026-1-void@manifault.com/ David Vernet (4): bpf: Enable cgroups to be used as kptrs selftests/bpf: Add cgroup kfunc / kptr selftests bpf: Add bpf_cgroup_ancestor() kfunc selftests/bpf: Add selftests for bpf_cgroup_ancestor() kfunc kernel/bpf/helpers.c | 103 ++++++- tools/testing/selftests/bpf/DENYLIST.s390x | 1 + .../selftests/bpf/prog_tests/cgrp_kfunc.c | 175 ++++++++++++ .../selftests/bpf/progs/cgrp_kfunc_common.h | 72 +++++ .../selftests/bpf/progs/cgrp_kfunc_failure.c | 260 ++++++++++++++++++ .../selftests/bpf/progs/cgrp_kfunc_success.c | 170 ++++++++++++ 6 files changed, 778 insertions(+), 3 deletions(-) create mode 100644 tools/testing/selftests/bpf/prog_tests/cgrp_kfunc.c create mode 100644 tools/testing/selftests/bpf/progs/cgrp_kfunc_common.h create mode 100644 tools/testing/selftests/bpf/progs/cgrp_kfunc_failure.c create mode 100644 tools/testing/selftests/bpf/progs/cgrp_kfunc_success.c
Comments
On Mon, Nov 21, 2022 at 11:54:54PM -0600, David Vernet wrote: > In [0], we added support for storing struct task_struct * objects as > kptrs. This patch set extends this effort to also include storing struct > cgroup * object as kptrs. > > As with tasks, there are many possible use cases for storing cgroups in > maps. During tracing, for example, it could be useful to query cgroup > statistics such as PSI averages, or tracking which tasks are migrating > to and from the cgroup. > > [0]: https://lore.kernel.org/all/20221120051004.3605026-1-void@manifault.com/ > > David Vernet (4): > bpf: Enable cgroups to be used as kptrs > selftests/bpf: Add cgroup kfunc / kptr selftests > bpf: Add bpf_cgroup_ancestor() kfunc > selftests/bpf: Add selftests for bpf_cgroup_ancestor() kfunc From cgroup POV: Acked-by: Tejun Heo <tj@kernel.org> Thanks.
Hello: This series was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <ast@kernel.org>: On Mon, 21 Nov 2022 23:54:54 -0600 you wrote: > In [0], we added support for storing struct task_struct * objects as > kptrs. This patch set extends this effort to also include storing struct > cgroup * object as kptrs. > > As with tasks, there are many possible use cases for storing cgroups in > maps. During tracing, for example, it could be useful to query cgroup > statistics such as PSI averages, or tracking which tasks are migrating > to and from the cgroup. > > [...] Here is the summary with links: - [bpf-next,1/4] bpf: Enable cgroups to be used as kptrs https://git.kernel.org/bpf/bpf-next/c/fda01efc6160 - [bpf-next,2/4] selftests/bpf: Add cgroup kfunc / kptr selftests https://git.kernel.org/bpf/bpf-next/c/f583ddf15e57 - [bpf-next,3/4] bpf: Add bpf_cgroup_ancestor() kfunc https://git.kernel.org/bpf/bpf-next/c/5ca786707829 - [bpf-next,4/4] selftests/bpf: Add selftests for bpf_cgroup_ancestor() kfunc https://git.kernel.org/bpf/bpf-next/c/227a89cf5041 You are awesome, thank you!