Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1723192iob; Thu, 19 May 2022 12:52:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPxW68Hgr/vcknhl+xdXPxi7vS1qPjjys/9c7YP4/Yqu59ZSNz9Rz8QjTDaw3knWGHZKcr X-Received: by 2002:a17:90b:47c4:b0:1df:ecbc:bd1a with SMTP id kc4-20020a17090b47c400b001dfecbcbd1amr1930748pjb.177.1652989941465; Thu, 19 May 2022 12:52:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652989941; cv=none; d=google.com; s=arc-20160816; b=FTytvDJE0RisgqlMFhB6ouyxHl8fGNghd9YvuUefb4nq4FtDiV9G9sgQH2HJCH8RpY BbKy7x5EK1+TsKRvdflJlwiIdbB5p2jST+NCjgz0UhAwUjPecm4KRmtfsnQ1eY0Z7Vph 1lvAl32ZGTeR+9NMVyrgpZP8bhkrOFdO5p/wU1RJ1Ge2pMmBm3UJfzxIfEzKEigbGPan DXSvfHZhULbR2rkWuHjXUQx1sSzrNipKw3ibJDJMnI/gfeviqBhPqfyJJf9vzZ19giKP +ZTCddVeM5RuCSjTwnNWDVJYSXG5UC/X9gg6qwFTzPmApo11zEaCSxcyDIf2QITfi2F5 dwfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Q9osOjg5SEQf5DXLZedr3XVR8VPlIeZRjkYt869VHRU=; b=QBZkvZQRFzQO+CTUU71onm/KdjLk9UdmvrLZMQMy8jRw8R4lTPxJDN/jVXZPtOzPeu wQAzTThspPFgOmhh7l6K/8QPJFXvkXNWMc6s6TrWmbvU/GhUZv9JK9cQxH3spdKv6csz kqchSKQyGiCYDzUhf0kHbITc8psnBPK4rUpRGOaBeMesUk7NVLxC7UMIKKBvshv4UENl Y3pmxikM9bNvMQHznmyq5zIrPgQfb6/gct9f4bYd7lWn97VITHfNYSfMyNzIAajtgQ5t Du/MWMav4q4+hMGajpqgIIo+rzUmswQE/P14+KB/Yaj8c1/X+T7sw6rlHpKRXDAUnTSo 9pRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=TmLYAlgy; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d7-20020a631d07000000b003f64026ba9csi3277734pgd.600.2022.05.19.12.52.06; Thu, 19 May 2022 12:52:21 -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=@suse.com header.s=susede1 header.b=TmLYAlgy; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242048AbiESQdG (ORCPT + 99 others); Thu, 19 May 2022 12:33:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241425AbiESQdD (ORCPT ); Thu, 19 May 2022 12:33:03 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C140B68304; Thu, 19 May 2022 09:33:02 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 7E38221B6C; Thu, 19 May 2022 16:33:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1652977981; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Q9osOjg5SEQf5DXLZedr3XVR8VPlIeZRjkYt869VHRU=; b=TmLYAlgy/fHvdR4/9jW2UdK+5qB/knaCOzFSFXm4Nre8kfaIVOlKZrhDHEYiPK7XUFYO9N r2YMBlzhiFpYyOvDKK5ZrTv3+Nr4QQ21SMrv95F7Cqxb7YTWtsZoASUVfhRsAKdZFE7k2A iACnDNmbm/SUQTUMMkllqn+uMvoR3nE= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5126C13456; Thu, 19 May 2022 16:33:01 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 8O7YEj1xhmLdfwAAMHmgww (envelope-from ); Thu, 19 May 2022 16:33:01 +0000 Date: Thu, 19 May 2022 18:33:00 +0200 From: Michal =?iso-8859-1?Q?Koutn=FD?= To: Vasily Averin Cc: Roman Gushchin , Shakeel Butt , kernel@openvz.org, linux-kernel@vger.kernel.org, Vlastimil Babka , Michal Hocko , cgroups@vger.kernel.org Subject: Re: [PATCH 2/4] memcg: enable accounting for kernfs nodes and iattrs Message-ID: <20220519163300.GH16096@blackbody.suse.cz> References: <22ccf325-6aa5-9b55-4729-d03f34125650@openvz.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <22ccf325-6aa5-9b55-4729-d03f34125650@openvz.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Fri, May 13, 2022 at 06:51:55PM +0300, Vasily Averin wrote: > diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c > index cfa79715fc1a..40e896c7c86b 100644 > --- a/fs/kernfs/mount.c > +++ b/fs/kernfs/mount.c > @@ -391,10 +391,12 @@ void __init kernfs_init(void) > { > kernfs_node_cache = kmem_cache_create("kernfs_node_cache", > sizeof(struct kernfs_node), > - 0, SLAB_PANIC, NULL); > + 0, SLAB_PANIC | SLAB_ACCOUNT, > + NULL); > > /* Creates slab cache for kernfs inode attributes */ > kernfs_iattrs_cache = kmem_cache_create("kernfs_iattrs_cache", > sizeof(struct kernfs_iattrs), > - 0, SLAB_PANIC, NULL); > + 0, SLAB_PANIC | SLAB_ACCOUNT, > + NULL); IIUC your stats report, struct kernfs_iattrs is mere 88B (per kernfs_node), when considering attributes, I actually thought of something like: --- a/fs/xattr.c +++ b/fs/xattr.c @@ -950,7 +950,7 @@ struct simple_xattr *simple_xattr_alloc(const void *value, size_t size) if (len < sizeof(*new_xattr)) return NULL; - new_xattr = kvmalloc(len, GFP_KERNEL); + new_xattr = kvmalloc(len, GFP_KERNEL_ACCOUNT); if (!new_xattr) return NULL; Again, I'd split the patch into two: kernfs_node and kernfs_iattrs+simple_xattr for easier bisecting. Thanks, Michal