Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp167902iob; Mon, 2 May 2022 16:08:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1fa1I6krGOg2dj8bSzrdIDejU+Az6+plV2jUZbySP45x2RqcXvQNSfWdMiqj7+uy+qO+1 X-Received: by 2002:a17:902:ecca:b0:15e:8971:4540 with SMTP id a10-20020a170902ecca00b0015e89714540mr13636671plh.43.1651532881839; Mon, 02 May 2022 16:08:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651532881; cv=none; d=google.com; s=arc-20160816; b=FV5KO5HnWgvl3HpQXaTkcUU+OxAINMHbMciAwZ6gQr5Ls41XZD1rYahKX3c1TbOLYU OHr1bw5AbS68GO+mTwsj0BFH/1q+R/wiUpAY5wL0eTSZng9bVXL3W2YgyWERARr+nX7t MnbYGtp5kZPt1IDmDXKFbs1ptG3400EVwXAQ1Y5RpN+Sbw8OXxxa5YYjxCDIRdLc20i9 e3XH6sypjQOtJT+X8y7tuJPFURQffe3wRzWKhZVjPf92RIbNWlfUdYAcBGI9zcy+7ef8 bg0W3KwmIGocKTN0nLaISuFm73rh/XaXUAF39ZSpn2mvPCexDy9ohls9tsoJ0lCq1iYD QDpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=J7CBsRSCXXbD2/NTY2D5JamVPix8X/S/pKY0BP5yLBM=; b=cTvgIjRtRtrYZY7Ck7uUF1jXhCGXTMN0bFX+mY+YaD9b+QniSwaJOaK/H1lZIisjIG nvMYa+6ShFRVAlgB7555WSQMQVZ4BcehvFDtpN5jOc4P06bC+hFdl1ot66JSIs2IVOVY JMozH65HAaoeVHkZlmL1dYLa7Wjd7LKTbjoPeHQiV/YV3v+Umf34NGj1P/QYVy24Guh4 3+V0tzJP5CM2oyiTdbH0k/DH73NclFG1hVf6z95If4HKDXJYrtMVIJuOs9rVqBiLZ75O MKb5UvHvtC8zl5rQq7C9qYyBG1ywR1j8FEf03pal3bMX0LJWwtwGfN1JL0BZ8RwmOq8i DK0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=t558Dsrc; 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=openvz.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id h69-20020a638348000000b003c21952c7c7si3885523pge.37.2022.05.02.16.08.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 16:08:01 -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=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=t558Dsrc; 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=openvz.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BE09D2BB10; Mon, 2 May 2022 16:07:53 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233519AbiEBTl0 (ORCPT + 99 others); Mon, 2 May 2022 15:41:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232548AbiEBTlY (ORCPT ); Mon, 2 May 2022 15:41:24 -0400 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21C6065D4 for ; Mon, 2 May 2022 12:37:54 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id t25so2830632ljd.6 for ; Mon, 02 May 2022 12:37:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz-org.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=J7CBsRSCXXbD2/NTY2D5JamVPix8X/S/pKY0BP5yLBM=; b=t558DsrcLANHfzoqL9k9rSR9hcDj2jp1a50++NsDsBG6Kqz8P1S5fyIO6vJzyeSnPY jFiS4a0TeP4oHp5+RCGhQezFeLCtr+ShAPkOlDPoanNfqphdGAdeEsopDn1HP0uTtmzl C+C1HgrN9fh76OvW++baovvPOP1si22RlJzrXefq4EEQaldw/C+ijUjxUxttekLO0mOJ jcK/lL9vBtiDxfDMTyxX0gQLfAt6JOhU2s8V536Mf8LPQCzyog9upddfbV27W5pSPiGV VpoLsS+GyYSl1fM2UJsRtiQCnZP3f6aY9+34QzJxKXQrXyeRPYErVgH2Xhxj7Cev4prC BxYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=J7CBsRSCXXbD2/NTY2D5JamVPix8X/S/pKY0BP5yLBM=; b=JJIMYfn0jMRazDsezXljBgRTaVFvJy+f0rMJHSHyoo7Q5z1rtNjRLtuLm7fyvtlh/+ a94FKKm0ZmgSilMtQNpZgKTvIa40FzVIK0Tdd7qQRCB9aGdZ/gm9YXSt+sVX7Uqd78g+ C0SaMfopqv279jXp91m5m19CTKafIheQvIiRAHD6Ly4SxMST1791jDuzhI9yxsDpOWh9 nrmovQ3jdaMRxxA1oDZ+1sbnPUoQCnOS2aNW5N5CPT9eYG1GI3f8H1yRJf8v6p0viVXZ 3bLJuN/9OQ8wzWzNsMsHGwG0d4Pht16UdDZmBCTnsVOQRZprdyS+cp3zFPxJ5knbCUCy aYcQ== X-Gm-Message-State: AOAM532TPkKX2bK3QqaWXMSE1ngELyUgQZAY7k8/zdvXphjmPdLSWJao ddxzOwyehH1F6b+NUarMWbX7Kg== X-Received: by 2002:a2e:86c6:0:b0:246:3c93:1c8a with SMTP id n6-20020a2e86c6000000b002463c931c8amr8410222ljj.354.1651520272491; Mon, 02 May 2022 12:37:52 -0700 (PDT) Received: from [192.168.1.65] ([46.188.121.177]) by smtp.gmail.com with ESMTPSA id e7-20020a056512090700b0047255d211aesm774858lft.221.2022.05.02.12.37.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 02 May 2022 12:37:51 -0700 (PDT) Message-ID: <7509fa9f-9d15-2f29-cb2f-ac0e8d99a948@openvz.org> Date: Mon, 2 May 2022 22:37:49 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: kernfs memcg accounting Content-Language: en-US To: =?UTF-8?Q?Michal_Koutn=c3=bd?= Cc: Roman Gushchin , Vlastimil Babka , Shakeel Butt , kernel@openvz.org, Florian Westphal , linux-kernel@vger.kernel.org, Michal Hocko , cgroups@vger.kernel.org, Greg Kroah-Hartman , Tejun Heo References: <7e867cb0-89d6-402c-33d2-9b9ba0ba1523@openvz.org> <20220427140153.GC9823@blackbody.suse.cz> From: Vasily Averin In-Reply-To: <20220427140153.GC9823@blackbody.suse.cz> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 4/27/22 17:01, Michal Koutný wrote: > Hello Vasily. > > On Wed, Apr 27, 2022 at 01:37:50PM +0300, Vasily Averin wrote: >> diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c >> index cfa79715fc1a..2881aeeaa880 100644 >> --- a/fs/kernfs/mount.c >> +++ b/fs/kernfs/mount.c >> @@ -391,7 +391,7 @@ 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); > > kernfs accounting you say? > kernfs backs up also cgroups, so the parent-child accounting comes to my > mind. > See the temporary switch to parent memcg in mem_cgroup_css_alloc(). Dear Michal, I did not understand your statement. Could you please explain it in more details? I see that cgroup_mkdir()->cgroup_create() creates new kernfs node for new sub-directory, and with my patch account memory of kernfs node to memcg of current process. Do you think it is incorrect and new kernfs node should be accounted to memcg of parent cgroup, as mem_cgroup_css_alloc()-> mem_cgroup_alloc() does? Perhaps you mean that in this case kernfs should not be counted at all, as almost all neighboring allocations do? Thank you, Vasily Averin