Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp84031rwe; Wed, 24 Aug 2022 17:35:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR5FxdIjR46oKG76hvRC9vem4tey42701Eb9r5iOdLbzocsAuxh3haZ6wlihLbVfv2zXSLJM X-Received: by 2002:a17:907:9803:b0:73d:836f:d266 with SMTP id ji3-20020a170907980300b0073d836fd266mr837683ejc.171.1661387759331; Wed, 24 Aug 2022 17:35:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661387759; cv=none; d=google.com; s=arc-20160816; b=CeAjeCFrOF/7Ld/DjqEQladaVCLzg3szrDSR/+YIUzBwEv7IcY68YHZrWcL0LJ2Wtd PLZqQWFHS+SNCBuZ+tkxWjP1ETj4KF0ybk7bJ6cEg05duh5ws7TUXayqmLweI5Vpv6x8 NWI3l0dVFZXlMgmiRImmkKqqPQsKLDUH4GFxqvfUpLWPvdgZvkWlJ6JgQPfM3OIBfj5z pBfNNT7SKHK5chMxEgDxSC0fcDBzLAMMRbTpSOO2jSe490Y/GYFmthpxGEIUiDK+7DAU +SzeoORtD01uptRJ6A6M/hSWEYCBxtFif/Xmgk0x5bRZ5DtSIHXSlS2clhY5Mcfc4pa/ 7fvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ciex1M3iqp5s8wXR0fILlM12xeyVcSZQd9Ahu6CFpUY=; b=t3HLuZ1hhjxGBknK+VoHMnFZ0yAeg+AzJkyJo60Gd/xAR3TTECmZJ7nn2l/12S5bTV 75xbbqeEE6JHXtlQL9Vl0kpue+ayK1YAbOrK3gO3eYPeClCYwjGdyacOWduoPkX8nWwS TErIl9QdYhvz6gc/A8s41CIVmex4w2RmMMGSQPlDyGSqPEiepcteQ+JA203K9mzw3wwP FDcUQzpfrLsUZiLJa4TLWjMdHWAy2TZ6kqJB+UzoGfFP2tq8h7XGGzKu9ZE6CxNJ7kjb cXbeG2JX6wVFI+G5KrZsdmxieknpxk2WiThJ+KQOf+7oiqoUNC8l/0vypcIPdGkqrnx9 +c5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PnF1b98q; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n12-20020a05640205cc00b004467c12a6bdsi6148406edx.459.2022.08.24.17.35.27; Wed, 24 Aug 2022 17:35:59 -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=@gmail.com header.s=20210112 header.b=PnF1b98q; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230268AbiHYA37 (ORCPT + 99 others); Wed, 24 Aug 2022 20:29:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbiHYA35 (ORCPT ); Wed, 24 Aug 2022 20:29:57 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA5881EAF8; Wed, 24 Aug 2022 17:29:55 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id sd33so15212323ejc.8; Wed, 24 Aug 2022 17:29:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=ciex1M3iqp5s8wXR0fILlM12xeyVcSZQd9Ahu6CFpUY=; b=PnF1b98qcTe7Aisdifeox05zIT2HLoeeBXiQ/PdvRwtGGKzs7ZPZi5t9iltgkrF9lz 1MBwCYR6xE3rzUIpCJVD8G0KKuiKvrmj/Hkx110eKCrnVFX9+nqJdWmEHn9epXVW9//o xsLf9VHdrJRxc3KxLLGOKpHYM7vRP2XP7c5kHOahCxdFb1H5fYSxRV7YPkqXWBvu97JC SfRGam+WaqVeGblpnXwbcD6+WZi3legeOsw8Qo3lUsh3XAsh62sLarHqMKR8m7EAaDcE CLI0XxIFxd24NjnH7yFnIYDgN70lK0XiFw19oN84Ng7wwaVJLhfrgDT/weuW8ctzDJpP 6Hmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=ciex1M3iqp5s8wXR0fILlM12xeyVcSZQd9Ahu6CFpUY=; b=I5CrJs42leoNhgTthkdJcFKPm8F+c32oQweJBKeRwkwedwNZF5IoC3GwyBjqHBgub5 OuGMaRSC8knNNzRfAZjXtuNT72JXhIBHXJJRisJmfpd/Gc2e9NKNySW2dSSwEGmOsA5R UsKcjcE7KKp6qNiPH45ddvgEItMNCZCU2y5q1QCnlmPk8vk5USxZ3+COsz0FhnAXshZw 03aGZUG6uTT2OSDideEsXVZqzydp04UfAwsnvB3dZ8yNmUHd/kDQ2Epm9iLoIljN9Lty IHoJ/G0eTG5lnkiSYJMSK0bJbFbYmnNEMXRmLIP66uI4QzZtpG4mOVSJuM6Ldwxtzj0y doBQ== X-Gm-Message-State: ACgBeo2xIHBvzOs8jTyKc2rbuj38IHl44xpDN9zeVmAI0UjhqZ4Xv/IK CbIlI5YvRn75sFfX1INZs+zHs6VQfwNkJwNqywM= X-Received: by 2002:a17:907:7b94:b0:731:1b11:c241 with SMTP id ne20-20020a1709077b9400b007311b11c241mr868514ejc.676.1661387394268; Wed, 24 Aug 2022 17:29:54 -0700 (PDT) MIME-Version: 1.0 References: <20220824233117.1312810-1-haoluo@google.com> In-Reply-To: <20220824233117.1312810-1-haoluo@google.com> From: Alexei Starovoitov Date: Wed, 24 Aug 2022 17:29:43 -0700 Message-ID: Subject: Re: [RESEND PATCH bpf-next v9 0/5] bpf: rstat: cgroup hierarchical To: Hao Luo Cc: LKML , bpf , "open list:CONTROL GROUP (CGROUP)" , Network Development , Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Tejun Heo , Zefan Li , KP Singh , Johannes Weiner , Michal Hocko , John Fastabend , Jiri Olsa , Michal Koutny , Roman Gushchin , David Rientjes , Stanislav Fomichev , Shakeel Butt , Yosry Ahmed Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Wed, Aug 24, 2022 at 4:31 PM Hao Luo wrote: > > This patch series allows for using bpf to collect hierarchical cgroup > stats efficiently by integrating with the rstat framework. The rstat > framework provides an efficient way to collect cgroup stats percpu and > propagate them through the cgroup hierarchy. > > The stats are exposed to userspace in textual form by reading files in > bpffs, similar to cgroupfs stats by using a cgroup_iter program. > cgroup_iter is a type of bpf_iter. It walks over cgroups in four modes: > - walking a cgroup's descendants in pre-order. > - walking a cgroup's descendants in post-order. > - walking a cgroup's ancestors. > - process only a single object. > > When attaching cgroup_iter, one needs to set a cgroup to the iter_link > created from attaching. This cgroup can be passed either as a file > descriptor or a cgroup id. That cgroup serves as the starting point of > the walk. > > One can also terminate the walk early by returning 1 from the iter > program. > > Note that because walking cgroup hierarchy holds cgroup_mutex, the iter > program is called with cgroup_mutex held. > > ** Background on rstat for stats collection ** > (I am using a subscriber analogy that is not commonly used) > > The rstat framework maintains a tree of cgroups that have updates and > which cpus have updates. A subscriber to the rstat framework maintains > their own stats. The framework is used to tell the subscriber when > and what to flush, for the most efficient stats propagation. The > workflow is as follows: > > - When a subscriber updates a cgroup on a cpu, it informs the rstat > framework by calling cgroup_rstat_updated(cgrp, cpu). > > - When a subscriber wants to read some stats for a cgroup, it asks > the rstat framework to initiate a stats flush (propagation) by calling > cgroup_rstat_flush(cgrp). > > - When the rstat framework initiates a flush, it makes callbacks to > subscribers to aggregate stats on cpus that have updates, and > propagate updates to their parent. > > Currently, the main subscribers to the rstat framework are cgroup > subsystems (e.g. memory, block). This patch series allow bpf programs to > become subscribers as well. > > Patches in this series are organized as follows: > * Patches 1-2 introduce cgroup_iter prog, and a selftest. > * Patches 3-5 allow bpf programs to integrate with rstat by adding the > necessary hook points and kfunc. A comprehensive selftest that > demonstrates the entire workflow for using bpf and rstat to > efficiently collect and output cgroup stats is added. > > --- > Changelog: > v8 -> v9: > - Make UNSPEC (an invalid option) as the default order for cgroup_iter. > - Use enum for specifying cgroup_iter order, instead of u32. > - Add BPF_ITER_RESHCED to cgroup_iter. > - Add cgroup_hierarchical_stats to s390x denylist. What 'RESEND' is for? It seems to confuse patchwork and BPF CI. The v9 series made it to patchwork... Please just bump the version to v10 next time. Don't add things to subject, since automation cannot recognize that yet.