Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1714154ioo; Mon, 23 May 2022 01:15:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzC4GtaAVXCQHrD4iVZpUrWfKLAYL8tPNRd3ZGGGfmQhtAGZxJzwdonjrGvrqK4F4dOvm/W X-Received: by 2002:a17:90b:4d8b:b0:1dc:a9c0:3d53 with SMTP id oj11-20020a17090b4d8b00b001dca9c03d53mr25225001pjb.29.1653293707054; Mon, 23 May 2022 01:15:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653293707; cv=none; d=google.com; s=arc-20160816; b=J3LFE3LxJ6IpfSsPmVQs+vccAeq79qctSIzMS1T13BzTmsEajDIgoZskCh7dwmWvY2 Jh5Ejukt0MYMEBl6FTOT5Zwdq0f45KoTF7COCqNkeS61yxL0HMhFj010f+pMIPmHAHi6 yxPpWY24I+nm6KaC5UJHeXkSiqOMQfhsGqxvnlJPY8bpnmNZlTr3/GDvQIW1zH0xOwaS 1Oxorbf526xGgnAjrSb2QBuD5n44JOScSIHeA1G7hoAERnXDvbaYPH0IFgrdXKmQHqMD oWmzM2l++xeBDpSWVN4BVp0WJJ9XPyxq3DZ+iUPNn89t7fE8Wi25CR0Ut3zY+v/US9IC Bacg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ww3nAvlupQzAe15WForrvTUe0x5VHXpHFHGu6B8UAqk=; b=jSZzoL3J+y+7mYkPAZmIrsvHnp9MoOkD4ABP7hniS3plu3shng6+sJztGBbJ0xU0wX I1KC33jP7qQ4sAHnShHwrIAXRenQxh3ycel9BAmPKEVKO6IpY3ntm9iNHORSa/F/wOMe skYiuUobocinc53j6/ZT4bulRUaOlcerU6B65B2uUkvNi/TtMJWpJU7g6NJC1svOyPWO ENyzHaNqEerzPyHRcxxvmJ7P5qpL9WzFWGh1l/5Xu11dKOJKZqQt0qHs85FJJeiG9kYw /xYd5TqrVtgbjBUQ6Wm+Pvjc+EzRpDaZkmKzmTWHbtxoD46EUu/ltgO0WJKZw4KIj1P3 n6Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=0hlZr6B8; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id y13-20020a170902b48d00b00161d28c3907si8858027plr.8.2022.05.23.01.15.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 01:15:07 -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=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=0hlZr6B8; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8BC476EB3A; Mon, 23 May 2022 00:09:31 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239598AbiEVGh7 (ORCPT + 99 others); Sun, 22 May 2022 02:37:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239474AbiEVGhv (ORCPT ); Sun, 22 May 2022 02:37:51 -0400 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C4A241637 for ; Sat, 21 May 2022 23:37:50 -0700 (PDT) Received: by mail-pg1-x532.google.com with SMTP id j21so10887361pga.13 for ; Sat, 21 May 2022 23:37:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ww3nAvlupQzAe15WForrvTUe0x5VHXpHFHGu6B8UAqk=; b=0hlZr6B8DnKA9bzHBoPJuI3N0q1Cxa5yWd71jCU7B3Tojl9HOUU6wHR4PdRbt3926z PpD0UBUcN4KB8EJzNWlrONVu2XF79Mb0TPZzt/dIniiOGp2rJCglibNMQXQ+A/RSU6Rc bmYuSZKGQVZ/C/nDTW+7XeQ3KZPgqd/uXpcV1t8SgG1FqN2j9TGmal5wzxx24mLowb1l /UiUu9pXvWMx7UtkUuN2gLwaB+MxIGAajXVqNAzSILYsGx9OE+2KcuJx2a6NQUsAxms5 rpYLG0Q+Iwna4R2DVnj4xz7A7aRXcBJ0umOpePq3Q5K/YuGiI5xvVIUehHJI8gbZ8d96 LhKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ww3nAvlupQzAe15WForrvTUe0x5VHXpHFHGu6B8UAqk=; b=wBo1yguH31Gybm8EGqR35ZGXaaseOJmYHhugAKqIiSzTrofV+dKLdeBXb+EC5jOz9U kTLNUKlFcfjdVOiG4zv4EtoesE0fzvaFZ0oS6Hfpgdh3zoK+ku8C+QIX5aGJD4148qWj a5h6OyGfeHA0xXAYut82RfHdTIfGQDVIf4O/DfoRhDxK76DD7ZtHTw5C0pKT9Nzbo2V4 cKujKJLeSueuB7Ldp1JsW2RnVdV1mhab8F/JYafnv9LtZ7G+pDWMAK7MBFVlJIcoiBV1 MG1M0SeGTfKPDarydHvS8tIySjEEQc3Q2S7qnlXINYkb3L/TBN9SieftlgSlaCETDEcn 7KKA== X-Gm-Message-State: AOAM530PDEQ/VNeDpkgiFCIPYxCYc0sFOrMrirkDC8PZqfsT9XrpuKk2 dy+TTkl+2FoYpP34iXIahdT80Q== X-Received: by 2002:a05:6a00:1805:b0:50d:ee59:b579 with SMTP id y5-20020a056a00180500b0050dee59b579mr18075256pfa.70.1653201469791; Sat, 21 May 2022 23:37:49 -0700 (PDT) Received: from localhost ([139.177.225.234]) by smtp.gmail.com with ESMTPSA id a3-20020a170902ecc300b0015e8d4eb26dsm2544678plh.183.2022.05.21.23.37.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 23:37:49 -0700 (PDT) Date: Sun, 22 May 2022 14:37:46 +0800 From: Muchun Song To: Vasily Averin Cc: Andrew Morton , kernel@openvz.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Shakeel Butt , Roman Gushchin , Michal =?iso-8859-1?Q?Koutn=FD?= , Vlastimil Babka , Michal Hocko , cgroups@vger.kernel.org Subject: Re: [PATCH mm v2 2/9] memcg: enable accounting for kernfs nodes Message-ID: References: <4f129690-88fe-18f2-2142-b179a804924b@openvz.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4f129690-88fe-18f2-2142-b179a804924b@openvz.org> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 Sat, May 21, 2022 at 07:37:49PM +0300, Vasily Averin wrote: > kernfs nodes are quite small kernel objects, however there are few > scenarios where it consumes significant piece of all allocated memory: > > 1) creating a new netdevice allocates ~50Kb of memory, where ~10Kb > was allocated for 80+ kernfs nodes. > > 2) cgroupv2 mkdir allocates ~60Kb of memory, ~10Kb of them are kernfs > structures. > > 3) Shakeel Butt reports that Google has workloads which create 100s > of subcontainers and they have observed high system overhead > without memcg accounting of kernfs. > > Usually new kernfs node creates few other objects: > > Allocs Alloc Allocation > number size > -------------------------------------------- > 1 + 128 (__kernfs_new_node+0x4d) kernfs node > 1 + 88 (__kernfs_iattrs+0x57) kernfs iattrs > 1 + 96 (simple_xattr_alloc+0x28) simple_xattr, can grow over 4Kb > 1 32 (simple_xattr_set+0x59) > 1 8 (__kernfs_new_node+0x30) > > '+' -- to be accounted > > This patch enables accounting for kernfs nodes slab cache. > > Signed-off-by: Vasily Averin Reviewed-by: Muchun Song