Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1673592ioo; Sun, 22 May 2022 23:55:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyESvusCaLg5S+HfX0v2Zh4kvWlgJlj21CAoDhGX7j3sILWhjFe8QOKT/GrUEMVQSMmBoZu X-Received: by 2002:a17:90b:380f:b0:1e0:9a0:4a99 with SMTP id mq15-20020a17090b380f00b001e009a04a99mr14289336pjb.158.1653288921257; Sun, 22 May 2022 23:55:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653288921; cv=none; d=google.com; s=arc-20160816; b=buu//4hv8SzdCwrW+sJiljPkNcIMdMCeoVQ9e0XTLVbiQhMDwW7Pn5EJXuo8K73tCG JBR2grylD1R5v3AZzfDTwrfg3BIYJVa5wa04ts3pWtEdWX6whM58C00tv7ifLuxXTsKI o9CbILturRS+fA73DsUtUq1Y+bOb8ZrpS5sgKDLDAeLbkcaXF1CEP9koszPbPwKrqJWL pLo/fIlfP1GfVcV2rZ0pelgSC0aOdlUOVBilMm241x2GloX1R9LHM5LAyirED2kZUi+M aNlKOhJCknEYItwUSbXLZpF3YbzPStA2RotY8IasGOHjprIt0x79rKo2ncGoZ9dlHRpI /JBA== 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=L2Pe0MYHq/Yx78fCTpUgbwdSX/KtiLZzQfFUiCB9rR4=; b=c8/fPsF+l3pcrXMxQglc1ebeBxcJegjVHWyxTmfPBy9PDwd3ybt0erGYHrqFjU8UyG Yg/bZEZUgO6+zYdG6dcb1nNOW2ZMzIHuHO8c5p7WBEudB6u0g7Iu6PW2III91HZ/prFq HOxwz5ZN9jF2RvqNNwp3+0TfnoKqK71A2oTmGLv8c37rMZBCV6G/4jmjpOWpQSSY6IwR e8tY2img0a6uyqScOm2iOtv5M2lwzorXWdc23JHrY4QXZn9qCrj46w3bp4CZevp54p/8 Mts4ki1FAY4lkEd5JpyBLOEhQMn73z/zp6Xsa/umKu4iofa5FsYzbGZYIr5KRiTjjJNO +Z/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=2yX+PxR7; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id p4-20020a170902b08400b001565a006f53si8855801plr.404.2022.05.22.23.55.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 May 2022 23:55:21 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=2yX+PxR7; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 BF551FD3E; Sun, 22 May 2022 23:21:11 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240365AbiEVGjA (ORCPT + 99 others); Sun, 22 May 2022 02:39:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240248AbiEVGi6 (ORCPT ); Sun, 22 May 2022 02:38:58 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C85C41986 for ; Sat, 21 May 2022 23:38:58 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id b5so3497402plx.10 for ; Sat, 21 May 2022 23:38:58 -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=L2Pe0MYHq/Yx78fCTpUgbwdSX/KtiLZzQfFUiCB9rR4=; b=2yX+PxR79RziW6XLaAynJWecE1Q0bheyhr3naloLu2PlOc+IfkrnlU/rZn33HmEjpv EdTY9j89e2UdiePS9za4CH5f9jEsK5SAldon3f6WO9nGwbMyVLhbBU/iZWDFkAtg+lSI WHUsv68nRcZvXAKJ5YbSlk8+0B5k9z3ARTy6Bs1SWP5L9xVAD4EbVnDMCwQLAL0cOXNm Z13qKhUnxfchrKP3qprM2GOZZnFc6kJ7UycB/bId4/bo8iOrIa9sorUPGtza2P+b+j/h mNalOAMptkd5Ci5/dhDH++4UW7brno4SVp2T2RWIdgCG2sEMp9mndu4EVvIMtffRkEvZ KdwA== 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=L2Pe0MYHq/Yx78fCTpUgbwdSX/KtiLZzQfFUiCB9rR4=; b=o8sZZd26Gp7qdviCztVQGEX2xNqH05fq2HV6WshPm4NIhPogsAeHeaAIK3XkRex2V5 XouN+k5NlZ7XuCWtVJuPCXU2+Hw4cf1XPnwfSeu88fMEpTH1YtogTtl1TgSXqm6OB3Cd fMVWqRZkHDACLatFE5tuycYkNIKa3FmmNb6LCpZ+AKZ+Gk+2OzBxpjE8KWeGkMb2VPrN wz0HhrM5AZlBMQVpcYPk8qtnbGKJIUC9O7S30IFKovSNquXOrkaqJHGMVor6tKhidGFr snn1vm3TZJzJwL64R9kSCD9wkxhg1fzwnebUd0PDBt71HqhhlLAfhrGE6r3d83qGx0O8 hNNQ== X-Gm-Message-State: AOAM533LOsdOhH0yy+opxbHdo2tcmHUh4ZMK8qwEJlf7lzcIvBJLzJKE YG/W146EQCZWLqMEjYomRymFOA== X-Received: by 2002:a17:902:8214:b0:162:188b:e326 with SMTP id x20-20020a170902821400b00162188be326mr2290099pln.129.1653201537317; Sat, 21 May 2022 23:38:57 -0700 (PDT) Received: from localhost ([139.177.225.234]) by smtp.gmail.com with ESMTPSA id i23-20020aa78b57000000b005187ed76a78sm2581240pfd.174.2022.05.21.23.38.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 23:38:56 -0700 (PDT) Date: Sun, 22 May 2022 14:38:54 +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 4/9] memcg: enable accounting for struct simple_xattr 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,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:38:11PM +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 > 1 32 (simple_xattr_set+0x59) > 1 8 (__kernfs_new_node+0x30) > > '+' -- to be accounted > > This patch enables accounting for struct simple_xattr. Size of this > structure depends on userspace and can grow over 4Kb. > > Signed-off-by: Vasily Averin Reviewed-by: Muchun Song