Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp112759rwe; Wed, 24 Aug 2022 18:25:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR6/5HLqdMXBJ1TSJ+Xlt0zQ5w1AGnWsPtN3+I0i9IsUjnykm73gKGW4OuuKvzbBrJq7SgRD X-Received: by 2002:a17:907:87b0:b0:731:3dfd:bc8d with SMTP id qv48-20020a17090787b000b007313dfdbc8dmr904486ejc.607.1661390737192; Wed, 24 Aug 2022 18:25:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661390737; cv=none; d=google.com; s=arc-20160816; b=BMG1V01W8cuebuknzDHnsAYNyjvqTnXUM0x3YGiS7F8IONYMp16KpMNrggK3+p4YZj ds7ko7Y06MkkFtdqglpTFdpxfJQP9xnMf/T1IXHTQaMjPVU9ltJAmw4YFweJlb6ACM21 XIV6UOMfD3OJRlsdzLLOB//+/ThcZuzD7iSUXLY/aD2/rubDYT4hcKYE920boc7hBJG2 x3TOlFxmTTrGvEIURvsMKj/XdShFHkpdpAy0Esy+YCJZSw9niozu6wNwJrB0B/ZZRaTi Ug74TW5pD/xgTvKQ1Z9rSOdB4CMYjbbD3yTXLj10AfcBeNrplpY9dSbskQ/uKl9Y8W/D OZNA== 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=q79ck/AetSOthZ6hFpX5t7QfBKfX7F+uUXc0H4h3law=; b=aH+NQz3s3BDHy2dXMvN9hd6zinn9kXfeSfaAtYCCyx3JXoqJDF8F6ldW+TMc9yiTX7 iN+4woSkW5oSjEaiyC5f8bIe2YGuxcPI37SZ8rz+3pkLPJxxGlxnEDf+xzihyCGHe/5o oTofTMq4oSvf1oTjHYAGPR5vSE/lxKqw6L4ArV5kDBHl9v6Tpj3cHg1OEWW2953ZCnKl 8Z+MEcweap6MLrqwGmV3brprWKkV5NaLMtJwunQ/AQ2j8ctyQRijN015I3K6+yw/KaK7 OYBC96MxRnUNiRwkpxgAkWExcUrrjIZPHKYfbW3w4A6he2Alf0bfghDoTx9XSndnKlXA 0wBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=I1ZnPe5O; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go37-20020a1709070da500b0073d7515b235si2886480ejc.533.2022.08.24.18.25.04; Wed, 24 Aug 2022 18:25:37 -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=@google.com header.s=20210112 header.b=I1ZnPe5O; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229918AbiHYAsx (ORCPT + 99 others); Wed, 24 Aug 2022 20:48:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231133AbiHYAst (ORCPT ); Wed, 24 Aug 2022 20:48:49 -0400 Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48C65915EA for ; Wed, 24 Aug 2022 17:48:47 -0700 (PDT) Received: by mail-qt1-x82d.google.com with SMTP id g14so4569905qto.11 for ; Wed, 24 Aug 2022 17:48:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=q79ck/AetSOthZ6hFpX5t7QfBKfX7F+uUXc0H4h3law=; b=I1ZnPe5OrWyp6LVENTFATmozgLZ7ZkdmjybmuFrk1V4XML5gtlNtieEL2obZoXMgxX nerAmkVQg+eYBWB2U5NJulY/1iBr5Q21ukGu4Hr8K9JSuY+Es3p3unZMzUkvu5l7rwJC xJ+/8z31Gi4kJn+b/JWcy03XRR6tNpcNLoDc1O75HphHnSS01Lk2S3oGcvZVQyMYgrl0 sW128SgJU2S0XgP9IrMdPIG9z497lkzKQ3NHZ1nokrc0hYaq3jVlRDf1LRbsxNTKjUpS DkkhpmDCsWUWwc/R3khgTuCovLvcCLxc5dqI5B50DqL740oIgIjgWjcIfsOo1A0UoRIp 0NTQ== 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=q79ck/AetSOthZ6hFpX5t7QfBKfX7F+uUXc0H4h3law=; b=Y0iF0M6Q3txAUAE0iCt6/TdwTn7ExmLFtEU1lRpSiCePfNizplBaunvrysdqb71K7k 5yW3ClcBU7NlsH2P5vuYEy5Izk3RZGzx+3KUwUiiLNFAOh9FQxzPFZVnCpCuEYwvlfN7 HJaa/0hY0SjyaFLvfN2Tibk1Aj5diTMrtveNlZpdiD/W57nqwUS29QWw+sM5K/qGMxS3 qHBfMq5lcGAaLSeGotQe2wDIMaFoR5hoFtda4FRxrJ7u5dovBq7RoiStleOY733DrjJH vfZ05Jh2Oy5lkXI6vUq8cdyfTqtjqxo4FXZvUOU7XObpybvEQ2CbAsTbiRclOXN3xKpz l8WQ== X-Gm-Message-State: ACgBeo147hzc4LgayxqVMRtgxssBNQhQxB26DTL91/Kama8QKlhXT3dv ksvQIc25FVg7mjB1ZWDrAtbb3DA6BaLrZB1Bj9TmQA== X-Received: by 2002:a05:622a:552:b0:342:f8c2:442 with SMTP id m18-20020a05622a055200b00342f8c20442mr1729734qtx.478.1661388526277; Wed, 24 Aug 2022 17:48:46 -0700 (PDT) MIME-Version: 1.0 References: <20220824233117.1312810-1-haoluo@google.com> In-Reply-To: From: Hao Luo Date: Wed, 24 Aug 2022 17:48:35 -0700 Message-ID: Subject: Re: [RESEND PATCH bpf-next v9 0/5] bpf: rstat: cgroup hierarchical To: Alexei Starovoitov 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=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 5:47 PM Alexei Starovoitov wrote: > > On Wed, Aug 24, 2022 at 5:42 PM Hao Luo wrote: > > > > On Wed, Aug 24, 2022 at 5:29 PM Alexei Starovoitov > > wrote: > > > > > > 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. > > > > Sorry about that. I thought it was RESEND because no content has > > changed. It was just adding an entry in s390 denylist. > > > > Are we good now? Or I need to send a v10? > > No need. Assuming that 'RESEND' version will be green in CI. Sounds good. I will monitor the CI. :)