From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02B72C433EF for ; Sun, 22 May 2022 21:54:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7FDFC8D0007; Sun, 22 May 2022 17:54:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 75E4C8D0006; Sun, 22 May 2022 17:54:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 589D58D0007; Sun, 22 May 2022 17:54:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 478058D0001 for ; Sun, 22 May 2022 17:54:46 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 3074E333F0 for ; Sun, 22 May 2022 06:37:51 +0000 (UTC) X-FDA: 79492423542.10.112629F Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by imf03.hostedemail.com (Postfix) with ESMTP id 5083920007 for ; Sun, 22 May 2022 06:37:39 +0000 (UTC) Received: by mail-pf1-f178.google.com with SMTP id 202so4063441pfu.0 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=Zeq8rPKzI6a2+3zr/UmIKmIm+Yot01OrJ8zEHy4EjG37RtOodxp7wY4jR0j+oU+Yrc fyRkBRYAhsHlnxZ47YyXMTWSey3r6I9lzqc6e0iuVAH5MaB8vL+dY187/WG3rOOdmKtn Gv4p+qiwH1UfhE4Tsp/id7FvATlcUBV3Db0E01WybM+B6emFuxKryG7nfYS6maSrD/zg 3ypsMD1zPL5S9M2e7OLhcHhWRZAG0tz1vgGEb0W5YYhQJd39JJeuXA2WzvhrYqUjskIk a2wrpMOGZx4iK0ufCngcmE/KgGZShwTLtyiE/mpQNiKWGTtfS0CkRrWVjs02cR79iC+F ipGQ== X-Gm-Message-State: AOAM530ARZpK1sDVdijtRGrC5s37TD7X2Je/spW0Xf+qtF4VcNe4cIYU WXqLg5AbCq5+2N2fSW99uFATdA== X-Google-Smtp-Source: ABdhPJyIZBcGgFP+4UB+K5yfgjsT0tzgCFbeo9E8vscX0ilcaErCbOnQlu7MK/v16rVc8+9e3lECGA== 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> Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=0hlZr6B8; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf03.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.210.178 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 5083920007 X-Stat-Signature: ekda73ieut85185ncro5y9waz6sfur5k X-HE-Tag: 1653201459-837724 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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