Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4754938ioa; Wed, 27 Apr 2022 10:21:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3WxWc4F5LB+c6ezF+GB1d3KjszkgKzbNKt+LwmydNSshUG7Wh+jqw7VlnNF8FDNartymj X-Received: by 2002:a65:4983:0:b0:3ab:ada6:af7e with SMTP id r3-20020a654983000000b003abada6af7emr5596305pgs.76.1651080061505; Wed, 27 Apr 2022 10:21:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651080061; cv=none; d=google.com; s=arc-20160816; b=BlKnPENsQhXsjpidbMs3lpiA7qpWlykpr5danvgEWFdcjcjDiwcQXtsLepPaByCeIz eACZ/sWruNB0+iCAjyOKiy+6F3fnXEt/mlsaShn8Nj/CWN736CepwTKCGxkw+KgpoO3A uB3b03339wxqCdNiN/3ZPydzZHeX4IsZ4yaVULdLaiYwycLEmFx0fVtfJvxvIG8L63rR luDJGHu61zYDp2F8o65vi821WEk4Hhpy+lFiB+P/DJWfxhUSP/3H+Gjjf7nJXh8/ySiI ZYyMnSb36yuR0xXR2OC8ZUCI5TcbvEvT37pbq1n6ei5WrbaP0q29uUImu6hJbj8U47iv 9DCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=vykJS+GCN4oOt/wUy0V+c72rmxebQEGqa0biVVI0j7Y=; b=u5Y+Z/6kb9idACts95I09lstS4zoVsdWiaUR7PV0m9f3J0Q/ycYm0GGwCZRUN5X7d4 smRSlOPNk9oErxB1L3wouw/NtfJItDjewtm7sf6Pk5oS6Rj/9oLNc4GSvPsTRs+DIlRd pm0IEILpPrBhtO3SEIP8Xw0eOCz+PIay2LTnRMUKwlba5Dry7DVI6GNgAb9U46F4C2wk ueOVZzhFufybwkxAFZZbjbrSMEeKH5o3vAhvConDD1Lw6yU/lpGqvtmnWk+zqZFprfLR cMzVek7ZVn75jvfYWeH9Y+osVCQkTgV3vPDpg+Xm6BSOuhdpsP5WuYkuSxYrD2oneUv8 /pmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="j3R3a5/J"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id pi14-20020a17090b1e4e00b001d94e8f4d26si2513766pjb.49.2022.04.27.10.21.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 10:21:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="j3R3a5/J"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 834FC45702B; Wed, 27 Apr 2022 09:53:01 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243537AbiD0Q4F (ORCPT + 99 others); Wed, 27 Apr 2022 12:56:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243528AbiD0Qzs (ORCPT ); Wed, 27 Apr 2022 12:55:48 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F5DA58394 for ; Wed, 27 Apr 2022 09:52:37 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id k4so2057481plk.7 for ; Wed, 27 Apr 2022 09:52:37 -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:content-transfer-encoding; bh=vykJS+GCN4oOt/wUy0V+c72rmxebQEGqa0biVVI0j7Y=; b=j3R3a5/JnI6fvngAk0q+6VHP/6OI5UNIT6V+w+qj8VLfcmJqtjseEGtXfaFyizk/IX PU/q6OweVYApqtV+lBDouzWxtm9XMMTYRudgUBSWgiCEQeTgIfT9DYFKVpCH58w1ERBM 7W5wA9x7X+j9QfaBRhyL2NKcYQLcxBJnX91rFinU+EE0JN6Yw0stS+Z5kOjleeuUHa2K JNrPLV5o8eERREFVn8dvNtQ1ddpTpcbK8yoa2y4mPAEolJ6zRBFHuOgsBd3YU6axaQCy LPZoUV3EUZ91yfLwtV5EQqd8BqSXjuWij1ldNudI+1JBYK35W2Fqwb/G6hIzlIzOXgYG kQlw== 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:content-transfer-encoding; bh=vykJS+GCN4oOt/wUy0V+c72rmxebQEGqa0biVVI0j7Y=; b=PN7CFD+DknwggCb8PJayancEp9IerF6WuQ+9pVhWyAXapGnVHAnHLN02GENFps7LCW 4Mg44yCTzsVyoz9xu8IyD5QOWWQVHI7/Ltfd7W69rYs3K/9leooEIJm40JybA3uEQIay YIL816Czme6ZMPIH76hleUWTeTKGRECOpv5tdGmlT0C1pGdGT2UR2+b1izs+6j4uhEXB xKhGzRZu6zjv+ipedmSt23/ZmfCuMjki1r+IAXwjncY+6rxBmrPB6fqwPs1nCByVoI87 SikKvfTIMeyO13KkPJ4ibpwb14v32+mY+2ZS/WlWT+ZL0IpU1cS3XuVEczTajj2WGEGj B0yA== X-Gm-Message-State: AOAM533JXh6AGrHxpvi3Bl/OJhxo6Mq3xXRR2WvuMbFRKnDWyenIFxja b41emgDVS7ouxhb5FhdXf2/AZnbfJ6yjaCVYqCNrPw== X-Received: by 2002:a17:902:b094:b0:15c:dee8:74c8 with SMTP id p20-20020a170902b09400b0015cdee874c8mr24420474plr.6.1651078356628; Wed, 27 Apr 2022 09:52:36 -0700 (PDT) MIME-Version: 1.0 References: <7e867cb0-89d6-402c-33d2-9b9ba0ba1523@openvz.org> <20220427140153.GC9823@blackbody.suse.cz> In-Reply-To: <20220427140153.GC9823@blackbody.suse.cz> From: Shakeel Butt Date: Wed, 27 Apr 2022 09:52:25 -0700 Message-ID: Subject: Re: [PATCH] memcg: accounting for objects allocated for new netdevice To: =?UTF-8?Q?Michal_Koutn=C3=BD?= Cc: Vasily Averin , Roman Gushchin , Vlastimil Babka , kernel@openvz.org, Florian Westphal , LKML , Michal Hocko , Cgroups , netdev , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Greg Kroah-Hartman , Tejun Heo , Luis Chamberlain , Kees Cook , Iurii Zaikin , linux-fsdevel Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,USER_IN_DEF_DKIM_WL 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 Wed, Apr 27, 2022 at 7:01 AM Michal Koutn=C3=BD wrote= : > > Hello Vasily. > > On Wed, Apr 27, 2022 at 01:37:50PM +0300, Vasily Averin = wrote: > > diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c > > index cfa79715fc1a..2881aeeaa880 100644 > > --- a/fs/kernfs/mount.c > > +++ b/fs/kernfs/mount.c > > @@ -391,7 +391,7 @@ void __init kernfs_init(void) > > { > > kernfs_node_cache =3D kmem_cache_create("kernfs_node_cache", > > sizeof(struct kernfs_node), > > - 0, SLAB_PANIC, NULL); > > + 0, SLAB_PANIC | SLAB_ACCOUN= T, NULL); > > kernfs accounting you say? > kernfs backs up also cgroups, so the parent-child accounting comes to my > mind. > See the temporary switch to parent memcg in mem_cgroup_css_alloc(). > > (I mean this makes some sense but I'd suggest unlumping the kernfs into > a separate path for possible discussion and its not-only-netdevice > effects.) > I agree with Michal that kernfs accounting should be its own patch. Internally at Google, we actually have enabled the memcg accounting of kernfs nodes. We have workloads which create 100s of subcontainers and without memcg accounting of kernfs we see high system overhead.