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 B06AAC54EE9 for ; Tue, 20 Sep 2022 02:27:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 44AD180008; Mon, 19 Sep 2022 22:27:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3FAD480007; Mon, 19 Sep 2022 22:27:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2E8CD80008; Mon, 19 Sep 2022 22:27:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 1BDE580007 for ; Mon, 19 Sep 2022 22:27:47 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id E18851407E5 for ; Tue, 20 Sep 2022 02:27:46 +0000 (UTC) X-FDA: 79930878132.01.6C38A99 Received: from out0.migadu.com (out0.migadu.com [94.23.1.103]) by imf07.hostedemail.com (Postfix) with ESMTP id 4FDF14001A for ; Tue, 20 Sep 2022 02:27:46 +0000 (UTC) Date: Mon, 19 Sep 2022 19:27:38 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1663640863; 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=eeERVvMe/yZ4WRpFkDFlzsr8+m+omuR9+WcKqeq+40g=; b=bk877dvOilqXPR/W2GG9QgSFDJ9hkO2gNM3LKayAg5uyueSbyMhG/o5ByJqgdQJ5D9Rzrn DWn1zzfwIgbieK6vuTTp9CrshXf8Ve3oCCt49LtQdIuprua3AncXc3rlU2hSF02RZMQF6N aDy7OIouYOiGvqP5COG4nKlU71QdrIs= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Kairui Song Cc: cgroups@vger.kernel.org, linux-mm@kvack.org, Johannes Weiner , Michal Hocko , Shakeel Butt , Muchun Song , Andrew Morton , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/2] mm: memcontrol: use memcg_kmem_enabled in count_objcg_event Message-ID: References: <20220919180634.45958-1-ryncsn@gmail.com> <20220919180634.45958-2-ryncsn@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220919180634.45958-2-ryncsn@gmail.com> X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663640866; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=eeERVvMe/yZ4WRpFkDFlzsr8+m+omuR9+WcKqeq+40g=; b=v/B82XDmYQZqhHzT61dthaSHk6ysAZ6USl9WU1GqNYKhHRK5dMWTQEHDidrw7hDczdN8JG bPLDe7lbimyh51V/Eq0LK2pCCW+zXdDgsQHOkmjvd3NTjuugBylf17NlTfxFEBIbXr8xFz ZhDrcFuu+SSYjO0dTT3XXOPl89/Y99w= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=bk877dvO; spf=pass (imf07.hostedemail.com: domain of roman.gushchin@linux.dev designates 94.23.1.103 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663640866; a=rsa-sha256; cv=none; b=xq/lFLgCH7Eu7MQEG6H2UoO2UjPiryVz7gj/oeaFAy0E3eIdieIAtPYL65HBLqPdSQsrLD vevLYY97OzJvEYF4FC9uk1WE7hYFw4FwYyFsvGzJybugbHG79bgVPFKJqYTwgdjHzQ5km6 K9ODY2tURvzlKZlJrn40Xej68lBlw+w= Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=bk877dvO; spf=pass (imf07.hostedemail.com: domain of roman.gushchin@linux.dev designates 94.23.1.103 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev; dmarc=pass (policy=none) header.from=linux.dev X-Rspamd-Server: rspam07 X-Stat-Signature: ci671313c8jqn75cdbz45ntd7wieynsq X-Rspamd-Queue-Id: 4FDF14001A X-Rspam-User: X-HE-Tag: 1663640866-353005 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 Tue, Sep 20, 2022 at 02:06:33AM +0800, Kairui Song wrote: > From: Kairui Song > > There are currently two helpers for checking if cgroup kmem > accounting is enabled: > > - mem_cgroup_kmem_disabled > - memcg_kmem_enabled > > mem_cgroup_kmem_disabled is a simple helper that returns true > if cgroup.memory=nokmem is specified, otherwise returns false. > > memcg_kmem_enabled is a bit different, it returns true if > cgroup.memory=nokmem is not specified and there was at least one > non-root memory control enabled cgroup ever created. This help improve > performance when kmem accounting was not actually activated. And it's > optimized with static branch. > > The usage of mem_cgroup_kmem_disabled is for sub-systems that need to > preallocate data for kmem accounting since they could be initialized > before kmem accounting is activated. But count_objcg_event doesn't > need that, so using memcg_kmem_enabled is better here. > > Signed-off-by: Kairui Song Acked-by: Roman Gushchin Thanks, Kairui!