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 5A68FC433FE for ; Sun, 22 May 2022 21:54:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9A9F88D0005; Sun, 22 May 2022 17:54:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 959828D0001; Sun, 22 May 2022 17:54:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7FB2E8D0005; Sun, 22 May 2022 17:54:44 -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 600688D0001 for ; Sun, 22 May 2022 17:54:44 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 942ED1208FB for ; Sun, 22 May 2022 06:38:30 +0000 (UTC) X-FDA: 79492425180.07.F5E55A8 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by imf16.hostedemail.com (Postfix) with ESMTP id 5B727180022 for ; Sun, 22 May 2022 06:38:15 +0000 (UTC) Received: by mail-pf1-f170.google.com with SMTP id i24so11057516pfa.7 for ; Sat, 21 May 2022 23:38:28 -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=63w6MmKKarIOHYX+K5PAEKcR1bSxb1g9RSGqBi4nt8U=; b=Wx+SmgtailJYnAhwvCnC+y1AuVwXo46QNLoLpoUb8rjVzBy5xo17x6lY2EmUp6sVHu l8rGunXcntC+8LTB0b38OVBedUWlQ47Xv+fYt8y2hIK2D9iH7/CRngOu9kSVBGc6TXFL 7RR9Zbl4Se+3YzKL9QmEf0AjB3Au30OSZlbshIcHneNizPzLdf4qfKySRtWPH6eV1RaD dCWHf2/vyiL69waPlmn2Ld3st9Y0kgrihwiSDETjrQ5145s8fQdluLTJ/0ltDMOY/OTR oRtt0ry2h3Xz7CDwMzplhnN0OtOJ3ZmREN/4PdnvTXgPq9UEFWaLcwwACBJihbNQeMim japQ== 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=63w6MmKKarIOHYX+K5PAEKcR1bSxb1g9RSGqBi4nt8U=; b=mhcvfeI2h4cI/QowaOlBpsAAM2Un5wCRCRiU2BMDorgE2BO9P+1tuD69bIbWrr7dqz RfFelhYTuiSYXXDZHz1Jf4ldVk5iojza8hDorXp26CHsh1vjbXwXBZLgnVfXElRtMHeT M3wp/QouQw+2H1JJl/1YbtMviKpzCbXAYKhUlcvnqD/pvLL2ez5Op0K1yL7b0+Y0wLnb tW2wgEuonIf9192GmMhD67U+G2yQFUjYtVcTWcedK2b70nv0Qtx3De6GXyvAdw+OZwuK Ap7UvJSyzHlC8Bc5W/WRWDxdKwtGQDiYyhvZSOTcwUWb22u1ieKQpbBFdMsSnNvIT0Ew YfFg== X-Gm-Message-State: AOAM531LmTxZ6fZwAEyZ1WUOT/1AcQWJuTayzbi65nhmbw/8IJTzs6m4 0PgbSRfjTixByXlWBWJSoO3NLQ== X-Google-Smtp-Source: ABdhPJyPgv2iVQpJ6evav+1kuZZv/Jsj382BjCK/UoWqPhAihMGhNLl0bmXOsZNbznk/KBMm7ROnOw== X-Received: by 2002:aa7:86cb:0:b0:518:3e92:f78b with SMTP id h11-20020aa786cb000000b005183e92f78bmr16689664pfo.61.1653201507382; Sat, 21 May 2022 23:38:27 -0700 (PDT) Received: from localhost ([139.177.225.234]) by smtp.gmail.com with ESMTPSA id n89-20020a17090a5ae200b001df6173700dsm4549568pji.49.2022.05.21.23.38.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 23:38:27 -0700 (PDT) Date: Sun, 22 May 2022 14:38:24 +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 3/9] memcg: enable accounting for kernfs iattrs Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=Wx+Smgta; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf16.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.210.170 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 5B727180022 X-Stat-Signature: eanbj33876kwpfpggqufgjbo4k8areq9 X-HE-Tag: 1653201495-224047 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:59PM +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_iattrs_cache slab cache > > Signed-off-by: Vasily Averin Reviewed-by: Muchun Song