Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1482245ioo; Sun, 22 May 2022 16:17:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxI/19fwb4HFvP6j7ajTgfS94sm2yosQAdpIykGkRABje7pcuPiZEQvu1LhYraGtX6i3Dmr X-Received: by 2002:aa7:d619:0:b0:42a:af7b:eda7 with SMTP id c25-20020aa7d619000000b0042aaf7beda7mr21254858edr.235.1653261453446; Sun, 22 May 2022 16:17:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653261453; cv=none; d=google.com; s=arc-20160816; b=hOv5Ab8JIcKbo17EDTtDPISGYdvK2SWFaSd+0UhV0DVAKEfilkIgL6ZHE5QepQAGqQ NgCYd3TQVE6Tq+7Bu9/rQIu97x0SoYw/ImaCOckhmnWbRa8dIm+OOH0kc2G/0NlfLsyO 70mtaTPzvIc3wiHTiBvY09Wt2/iUc82HjATG1sR4uBvlD1d1TkQrp2VbLjptGpKScZ72 BDRlhg3xmopL43CRQBC02hMvlYQGu3Xr+xQsC4n2slRZmQyh0Iw3VUTdNmbImRq6iPO8 WHNezPczH7vn5Y8YJrNj+sQY8v50e9vpmLSN+97YDitiTTS7sKe4xmB6MIXkAGVTJmf8 XLug== 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=63w6MmKKarIOHYX+K5PAEKcR1bSxb1g9RSGqBi4nt8U=; b=SZ/64Uf5P+WzmtdmMPOuR7mxMTY6gdDQYOWdC84sBvXRv9oWzZyHJW31BjlwqR248K QKNFIHaNGtjRpYtfBwyv6pPzgPRxUv54Uo3IKx4SYYwc3VepYvLgyN685L7Tav3bY00w pYTA1DekdE61SfvlfG6wjjOSrhrb8OPl+vTLtwCuQhQ99Ere69tKcWsqFJM9s2AuErG4 y3Z9/ZdzOHODinQgSmsiaYe6vyEcWtF2uIf5iwEXogd8K124a8hwy+pNMpkMgF2zfVwy 2V6tUFs2ih4w+Ktb/G7SDVntyvEDppNR/E+u+JJyjYE3xI5ubNAvFn13E/RyMG2ohDtx JnBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=Wx+Smgta; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eb8-20020a0564020d0800b0042aeb68e5fdsi15688801edb.287.2022.05.22.16.16.59; Sun, 22 May 2022 16:17:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=Wx+Smgta; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240460AbiEVGig (ORCPT + 99 others); Sun, 22 May 2022 02:38:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239898AbiEVGi3 (ORCPT ); Sun, 22 May 2022 02:38:29 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3B704163C for ; Sat, 21 May 2022 23:38:27 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id bo5so11068254pfb.4 for ; Sat, 21 May 2022 23:38:27 -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=UWMtp9JZwmdQ4cSuLKLGbnWMiUuHn9fScGxhL4y/sh5qiEmVuT3winIXw1QcezyVLt bEUhyssjE0FVJF86YIXhmDaaOI/PTQnHG4Jo87byYARmRe/iO47WRNgNA9DxLQaOlD91 X8MsAAONtreL0F/xnbcw6tCiPUq2+8tldSejSd0WhWbZ8zpTYVNrjaDcBgRvMtNEXoUJ JdpcFtYWleC7NRZfdSl+ZXjjkdsop/jeeenVxMYmPGIiCZ7kkSbRM+G06BunbKI372Qd sOXaTLN9vhwK3bbYDa8gAUbCUUYkT6QxaDl3cTbwaS4KAVKCnB//lv5Z7tJ8Wi6J0Ttb VCPw== X-Gm-Message-State: AOAM530zvbqAdi+ZeXS9GiwH4GZTqIh68P6oBtIbCs8vLen8C3SUtugl roFMDK2n82iiPzmqknBYIn26Tg== 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: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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: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