Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp6399963rwb; Tue, 9 Aug 2022 14:48:07 -0700 (PDT) X-Google-Smtp-Source: AA6agR6cKQBOGoWwu7FWKiqkVpPZx7N34d/iMUARxJPJKz8QZcNMyi8UAVIZePZhPzF1AhoMQUg5 X-Received: by 2002:a17:907:16a7:b0:733:15:2928 with SMTP id hc39-20020a17090716a700b0073300152928mr1542856ejc.117.1660081687298; Tue, 09 Aug 2022 14:48:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660081687; cv=none; d=google.com; s=arc-20160816; b=mUYrQTLckNqKWa4Li0AvH1eyZQM8BXCIWMjDO4GiJ/ij6j27LspPAZsZzAmN63Hbj6 4Oz2xDpIwEYgCdtiMguKJNfF3RPdZ/b6EhzF8z5QiAMpjCtSibTcomwjH5DbjCt/xz20 5GY3XIdn2jlpRWO2A28kpEbiBgZaa7PidVGjNdIHrHjvcCkWf0/laNGc8ynFdrTOdKU9 84AQuSXiFSctOFLfMdkEWiCG2mLz6Y/o1sqgV6BiOpeC73C0mf0Cq+FWN8rvLLn5ESUd iMo7e1msL3MpksryeeE3IfssEkqyhRtRdXQ57rluCPdovC3xY7r8rzcA0EJWXh0n+oO3 AIZg== 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:dkim-signature:date; bh=TJ+FDVpBSEzK2EoXIhVyyu6wE3zilcScyC8ojStCxxI=; b=Aj775v+72OISEfrpbCzZIrw95c1H/gep/vCysFULeYA1j3+jPDW58GwqNcA51YknCa AIMcPbPF+TUThi96DR4C9HUrLZMmTgfXoyfYJsX1bj74YgGp69mdhNZCviuLoy6hAG56 pnSzZxINdejBj2aLkHbD0mGlf740jOImN86FeAC28pdPuOyzqjD+m2T4pbbgI5TA7cAG 4RiIUg5CftuD3P2EZoqMkG8q/W9AZjgOMjMGKEn35GsjfuQqG0pfmgB2JrP6D1wa6ffE 6bHXJFXNXRD6d3G+g/Az7Nws+xgATF+oE4tj+o/kb152BP9CF160EH+mtA9pjS89rA4b UfHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=HKMgL2g2; 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=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga33-20020a1709070c2100b0072b6e6512e5si2619821ejc.490.2022.08.09.14.47.42; Tue, 09 Aug 2022 14:48:07 -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=@linux.dev header.s=key1 header.b=HKMgL2g2; 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=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229717AbiHIVZn (ORCPT + 99 others); Tue, 9 Aug 2022 17:25:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229757AbiHIVZ2 (ORCPT ); Tue, 9 Aug 2022 17:25:28 -0400 Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 296E545F49 for ; Tue, 9 Aug 2022 14:25:26 -0700 (PDT) Date: Tue, 9 Aug 2022 14:25:05 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1660080325; h=from:from:reply-to:subject:subject: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=TJ+FDVpBSEzK2EoXIhVyyu6wE3zilcScyC8ojStCxxI=; b=HKMgL2g2MTuLe3kMQ7rhzrqmOSRlArIEpu4G+sQjvFpRJVKvBIYoEuPPFu+SFlekJPp+3r GD3rz8CMtEbJMY8a7jajFAQKq8C+Nximk++6uZre2bbGS3uI67bi4GEj50hdCEFXe5K3h6 6LNlP/5GkH7WEx89qwRXtFq/jYh9B80= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Tejun Heo Cc: Vasily Averin , Greg Kroah-Hartman , Alexander Viro , linux-kernel@vger.kernel.org, kernel@openvz.org, Shakeel Butt , Michal =?iso-8859-1?Q?Koutn=FD?= , Muchun Song , Michal Hocko , Johannes Weiner Subject: Re: [PATCH 0/3] enable memcg accounting for kernfs objects Message-ID: References: <0414cab3-32d6-c60a-d3c8-96fc72064ba0@openvz.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, 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 Tue, Aug 09, 2022 at 07:31:31AM -1000, Tejun Heo wrote: > (cc'ing Johannes) > > Hello, > > On Sun, Jul 31, 2022 at 06:37:15PM +0300, Vasily Averin wrote: > > 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. > > So, I don't have anything against accounting kernfs objects in general but, > for cgroups, because cgroups are what determines what gets charged where, > I'm not quite sure whether following the usual "charge it to the allocating > task's cgroup" is the best way to go about it. I wonder whether it'd be > better to attach it to the new cgroup's nearest ancestor with memcg enabled. I also like this approach better, however Michal had some arguments against it. I don't think there is a huge practical difference, so I'm ok with either approach. Thanks!