Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp394235iof; Mon, 6 Jun 2022 05:38:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAtROawcPK+zmwsu5HetxHMqHohFYL0r5cI/jz/cR8MDqOmFI4yJf/xO0EGR/TQ79dAawz X-Received: by 2002:a17:902:bb90:b0:156:2c05:b34f with SMTP id m16-20020a170902bb9000b001562c05b34fmr24475157pls.53.1654519121357; Mon, 06 Jun 2022 05:38:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654519121; cv=none; d=google.com; s=arc-20160816; b=iYqU3zpAlk3fVCLzWqIQhFQEGnSIfwJIJLwu69iN9Q/SrccJQne57TxenzWeIvxrtG yiRvk0zhFiNP3urkCNEji9KTzVwxhTCPlf5qFg0Va9Djh6riWWcCKea+n+PRVppTjBo0 VUWr1ZGKq/h4PaM48+dmK+2uoCaDZjDkKLcYld4uEmJ08kZM8FbKT39gR+B2fb8vGjLj 6b2JZX4C5QFE8mJ0r9/jri2C8ugxEVwZjwPPXmETbvrYY3R5ZdJjjj2m+O4seHRhfeO1 UhBk3Gr72l0l1Z3NiMZpG22J+ApJur5kwgya505FijVflyd39om/zFCpHn9TzpEc/rQE H67A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=QmnQvelulN9ISJl++c1aKnCaY5Y/JjxqU7vIBDvzm3w=; b=0jDOsgtMqcX4MaHXcKi/juZQAfFMyn8m1sA6u/REFn30PmH/f9ce04Pt4iZirB3yjd 2QRvYqUASWuhSf0Pxr5C2wwmrkx8eXfjqGuyXpxU+h5+wYC2WaPtOs+1kz7735hRyLwj EOC5lBcTdSoDFFg2sOgbw/LqeKh+MJnnXez6j5pa6C7sBSytka2g1nw3v2ceflCxU2dx efvFUiNJH7yZDZvsgvEZydMdU9m9IguP8oJs10uQ1/yWrnRU7kl7ky0cKoaEMhP+knz7 s4q7eiAOOKmRXCnGsD5t6eipnjz1hVGmXWVyylfnVtjBO3lFOPJVunV40xEzQEP6p776 EnaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=MwHhGVS1; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id v11-20020a63f84b000000b003faf4fe0274si21110184pgj.140.2022.06.06.05.38.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 05:38:41 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=MwHhGVS1; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A132E703F8; Mon, 6 Jun 2022 05:32:43 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237096AbiFFMcT (ORCPT + 99 others); Mon, 6 Jun 2022 08:32:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237064AbiFFMcO (ORCPT ); Mon, 6 Jun 2022 08:32:14 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB78E2716; Mon, 6 Jun 2022 05:32:12 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 626331F8C0; Mon, 6 Jun 2022 12:32:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1654518731; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=QmnQvelulN9ISJl++c1aKnCaY5Y/JjxqU7vIBDvzm3w=; b=MwHhGVS1WO72E8CSbOvvz7pMIKubeYL4Ju+e8htY06tSlEPcNG9Ywrq92+6BEYUlqG3M1C 68EmP9B6vOmAU4fTcCbXDh8q1bnGbCeY9LnC3kV2HxIYSs5qB5XmUqeb8zI7AvhBKgnH4z /P+WXycLAm7EQ5lm1ROAwJhKcDHvrNs= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D0C9D139F5; Mon, 6 Jun 2022 12:32:10 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id YWykMcrznWIcPQAAMHmgww (envelope-from ); Mon, 06 Jun 2022 12:32:10 +0000 Date: Mon, 6 Jun 2022 14:32:09 +0200 From: Michal =?iso-8859-1?Q?Koutn=FD?= To: Yosry Ahmed Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Hao Luo , Tejun Heo , Zefan Li , Johannes Weiner , Shuah Khan , Roman Gushchin , Michal Hocko , Stanislav Fomichev , David Rientjes , Greg Thelen , Shakeel Butt , Linux Kernel Mailing List , Networking , bpf , Cgroups Subject: Re: [PATCH bpf-next v1 0/5] bpf: rstat: cgroup hierarchical stats Message-ID: <20220606123209.GE6928@blackbody.suse.cz> References: <20220520012133.1217211-1-yosryahmed@google.com> <20220603162247.GC16134@blackbody.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 03, 2022 at 12:47:19PM -0700, Yosry Ahmed wrote: > In short, think of these bpf maps as equivalents to "struct > memcg_vmstats" and "struct memcg_vmstats_percpu" in the memory > controller. They are just containers to store the stats in, they do > not have any subgraph structure and they have no use beyond storing > percpu and total stats. Thanks for the explanation. > I run small microbenchmarks that are not worth posting, they compared > the latency of bpf stats collection vs. in-kernel code that adds stats > to struct memcg_vmstats[_percpu] and flushes them accordingly, the > difference was marginal. OK, that's a reasonable comparison. > The main reason for this is to provide data in a similar fashion to > cgroupfs, in text file per-cgroup. I will include this clearly in the > next cover message. Thanks, it'd be great to have that use-case captured there. > AFAIK loading bpf programs requires a privileged user, so someone has > to approve such a program. Am I missing something? A sysctl unprivileged_bpf_disabled somehow stuck in my head. But as I wrote, this adds a way how to call cgroup_rstat_updated() directly, it's not reserved for privilged users anyhow. > bpf_iter_run_prog() is used to run bpf iterator programs, and it grabs > rcu read lock before doing so. So AFAICT we are good on that front. Thanks for the clarification. Michal