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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D225C6FA82 for ; Tue, 20 Sep 2022 02:28:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230124AbiITC2P (ORCPT ); Mon, 19 Sep 2022 22:28:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229903AbiITC1r (ORCPT ); Mon, 19 Sep 2022 22:27:47 -0400 Received: from out0.migadu.com (out0.migadu.com [IPv6:2001:41d0:2:267::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC33B248DB; Mon, 19 Sep 2022 19:27:45 -0700 (PDT) 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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!