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 2EDCEC433EF for ; Sun, 22 May 2022 21:54:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B57A28D0002; Sun, 22 May 2022 17:54:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B05B08D0001; Sun, 22 May 2022 17:54:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9F6708D0002; Sun, 22 May 2022 17:54:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 9194F8D0001 for ; Sun, 22 May 2022 17:54:43 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 9F98B34335 for ; Sun, 22 May 2022 06:38:58 +0000 (UTC) X-FDA: 79492426356.20.CBE75A8 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by imf28.hostedemail.com (Postfix) with ESMTP id 9D050C001B for ; Sun, 22 May 2022 06:38:28 +0000 (UTC) Received: by mail-pl1-f169.google.com with SMTP id n18so10544468plg.5 for ; Sat, 21 May 2022 23:38:57 -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=HqtASvDReGVlnqL5qLTz8mB0K7Tc3dqXposbqzaCE85yqOscPevhRdQOO1WpPPcBK4 AK8GR33Pkn/nOlzy11Xn4KuYXSttGD1TSun5PM/rGy1R17RVfPjtl6iJsJDnZTw3u2UH WHe+PeG/BdFbW3fe3P8+nRIJkNBtNhaTI0EMQ1zORt/iEx5QQXCVmTi05y8vI7T+YtVh QDiw40lGu44hdrKHfum6XLRZ6IgFNqQnfMYG97mTv87YAZ6iXYWlVFDX62KUw+JddEYa SAE4wwKhVkUDHeZPi4iWCSd8oRnpmLfyhvyVj4q5UN5fe2+uu9j4XlKIdL8y5v1rO8Ov LrIw== X-Gm-Message-State: AOAM532pePVdIOuXjrC9/2q7P+MKYfsqOyH0v71L0wXsPL1u31OlREiK xOBQGOh0xFxMeMdevVcxMMFmRQ== X-Google-Smtp-Source: ABdhPJywflv0j9NZ/ircUsYHj7JAaBn2Uy5Z2shosb9G2vUS2CksYAtESm7vYVdrN/w6La8I/F6Zzg== 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-Rspam-User: X-Rspamd-Queue-Id: 9D050C001B X-Stat-Signature: gbfinsz7idcgzuqq7uhzxt89okxs85bd Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=2yX+PxR7; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf28.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.214.169 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com X-Rspamd-Server: rspam04 X-HE-Tag: 1653201508-848341 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: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