Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp4590038rwb; Wed, 17 Aug 2022 02:43:31 -0700 (PDT) X-Google-Smtp-Source: AA6agR4rAHLFWnBBZLXi+q2Jq6xlzVsFNNmPhr+mYRF7nPh7YGnPreI8Pxt+pAn0ZYb3Li/21iZ/ X-Received: by 2002:a17:90b:198d:b0:1f3:f72:cfdc with SMTP id mv13-20020a17090b198d00b001f30f72cfdcmr2899095pjb.237.1660729411077; Wed, 17 Aug 2022 02:43:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660729411; cv=none; d=google.com; s=arc-20160816; b=Rm2IXIr6RITfWnpCcWype7619LgRXWwa3Kn+LhZcq/WbyhaKwZrY9n9S1aX8x+FQOW gEfyOh5jK4tr4JeD0yjcGYEDlzT0nNiixg2mQkMbtQJjP5/1nMnQPgWFZa5CVpAZe6Bv eb3ZryEGMN9Kt8L3TrmjghUBrzxyuq8LvOUlvs1xL2qEMbIueGnOYtekut4PaUq/P/zV HwhlWNxzyGIb53dBs6+dYc3tF3MuP/vMAr4NQNaZ+gsLt1XPIvC3IA6R4d8cozzcf1kO HI8OQbUSHo6IzgRyEdOmoCgeiuc9pDwEYFhBN4snVlkOnZis6IYgo1DVMWTBbcm8Is0i wr7A== 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=I/B2eXUmZ1muy3ZNR9dI48LMMOtZGNNRF+Mq92M7IjA=; b=wWNe1PZdZ4DW5VBjT+HFy+WybiIdXn+8qb9LmArZBoHrIVSAaDCVv4YNMPC9C8bq4n QWDJBmkqRvVHQw/hmJNo1VU+qpTpyUMpTd81HUbqhT8/MhASSsrFAUgpBYl72OiNXbDY u3XQRVaRK8Fe+NF94zgi/vz9ODnkT0oG9dEpI3UNLOaK+SBcbf9LTzY8npacBxfLLZSc IshRPhJMrzB53BMOgs6Du9QVS9PtTW3jEwAGO0hQaU05slGur0vqs+AAy2HRAAXh6Bzy nHsaS4fFo4JwbGHAEJEtMfCt766L5R1wW+icS0r6QIrOK6XCUxiDv+mdEu4ZVjV9jK/k xoUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=NcKTGz94; 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 s134-20020a632c8c000000b0041c506dde92si18206432pgs.636.2022.08.17.02.43.19; Wed, 17 Aug 2022 02:43:31 -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=NcKTGz94; 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 S235004AbiHQJRe (ORCPT + 99 others); Wed, 17 Aug 2022 05:17:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230366AbiHQJRd (ORCPT ); Wed, 17 Aug 2022 05:17:33 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C88B16B8DC for ; Wed, 17 Aug 2022 02:17:32 -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-out2.suse.de (Postfix) with ESMTPS id 573291FE77; Wed, 17 Aug 2022 09:17:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1660727850; 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=I/B2eXUmZ1muy3ZNR9dI48LMMOtZGNNRF+Mq92M7IjA=; b=NcKTGz94mD2uDswiSMU1bXxsK8/BpsJqOk04AtGtOqo31CTgcmowgMq1PhFAPc77CgT4y/ V0A4Eso10+h9g++zhT5jOkyEa6ISx94H5JJ3BdkuwCLupNJU0zh426N/BtcViTiI+9M0k3 bIor5uXp07zXSR9tmtQyzVj/uQ3N1mM= 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 1E80313A8E; Wed, 17 Aug 2022 09:17:30 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id glNqBiqy/GIEagAAMHmgww (envelope-from ); Wed, 17 Aug 2022 09:17:30 +0000 Date: Wed, 17 Aug 2022 11:17:28 +0200 From: Michal =?iso-8859-1?Q?Koutn=FD?= To: Vasily Averin Cc: Roman Gushchin , tj@kernel.org, gregkh@linuxfoundation.org, hannes@cmpxchg.org, kernel@openvz.org, linux-kernel@vger.kernel.org, mhocko@suse.com, shakeelb@google.com, songmuchun@bytedance.com, viro@zeniv.linux.org.uk Subject: Re: [RFC PATCH] memcg: adjust memcg for new cgroup allocations Message-ID: <20220817091728.GA23229@blackbody.suse.cz> References: <62188f37-f816-08e9-cdd5-8df23131746d@openvz.org> <45a04b75-d61b-4c7a-7169-c971995a6049@openvz.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="YZ5djTAD1cGYuMQK" Content-Disposition: inline In-Reply-To: <45a04b75-d61b-4c7a-7169-c971995a6049@openvz.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 --YZ5djTAD1cGYuMQK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello. On Wed, Aug 17, 2022 at 10:42:40AM +0300, Vasily Averin wrote: > However, now we want to enable accounting for some other cgroup-related > resources called from cgroup_mkdir. We would like to guarantee that > all new accounted allocation will be charged to the same memory cgroup. Here's my point -- the change in the referenced patch applied to memory controller hierarchies. This extension applies to any hierarchy that can create groups, namely, a hierarchy without memory controller too. There mem_cgroup_from_cgroup falls back to the root memcg (on a different hierarchy). If the purpose is to prevent unlimited creation of cgroup objects, the root memcg is by principle unlimited, so it's just for accounting. But I understand the purpose is to have everything under one roof, unless the object lifetime is not bound to that owning memcg. Should memory-less hierarchies be treated specially? > +static inline struct mem_cgroup *mem_cgroup_from_cgroup(struct cgroup *cgroup) [...] > + css = cgroup_get_e_css(cgroup, &memory_cgrp_subsys); > + > + if (css) > + memcg = container_of(css, struct mem_cgroup, css); Nit: mem_cgroup_from_css Regards, Michal --YZ5djTAD1cGYuMQK Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQTrXXag4J0QvXXBmkMkDQmsBEOquQUCYvyyEwAKCRAkDQmsBEOq uSCPAQCeYjJ/qm++P/4MyI2v/wOc/rxsPsDWD5iNCRSC8V4fgwEA5ul4VN0roAWb w7p+yQKU1DsET1vl+iysCsdEjcDYywE= =WPtl -----END PGP SIGNATURE----- --YZ5djTAD1cGYuMQK--