Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3333150rwb; Mon, 19 Sep 2022 20:03:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Z4nPS1eaKUBsvMziWVoaumO1rpnNRULR9St1PxmzXxfQ+P4X85BspIuw51D56cO0KTgLM X-Received: by 2002:a17:903:2345:b0:178:1991:178b with SMTP id c5-20020a170903234500b001781991178bmr2913080plh.106.1663643038553; Mon, 19 Sep 2022 20:03:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663643038; cv=none; d=google.com; s=arc-20160816; b=xyrM80yju8gUN2zIK0a955B4q4yo55dkOvUk30nULXnPDBK6AcRPLUyLymT9LjUiK/ IS/B+sl1TnsmWCtDGej5uImHJznfnT7b3cbWgICCUsGlYR+U2H7dZRj54l4y//FGQP9t IXTmEr7lvfcvL9wpja1rrM5GMKduz4sahFnJaiEswe9nA9MqpN4pxcxTV80k2PLyCDwz 8lwoL5ssUN2SStb5NIhLH44eNffODRqzYX3R+dFJ/8R1csPW0zQ38h9s6L6qCrDurWDk 5SS9Nd6v+I1fV4/Llp1UrwtGCAaIoZtGLcDbY3Qktzv0NU7JWphEGnhvwbjCaTTGD8qN i/nQ== 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=eeERVvMe/yZ4WRpFkDFlzsr8+m+omuR9+WcKqeq+40g=; b=d4EU5JGsVFi5gwLn0g7bdBKQaCj+uoXomLytq35GoLRIEI1g6R4VhyTCdRrS8Y0um1 gFotJOBMndR/s7qSKfu52OprKVjurpU0p+aJrHqLIZ9m0t8NlN4k/NpdVwV+/xauBzyb 9l7u3V5u+q4QjDvi47HstMNkn4RXmOVNknOyyQXpFbfUpS0JpUM/d7V9rnVGaraDrzqr 92GdhlMIQyXhpl7aV84Z/CxWsHblOBKiyplw/NqZdfYPratmmXhi8uNcJjjkNriUxTKH QLAK+uwcxs41nTJUYngbLvO3e1yV+tHpT+LcY75+JmbrYgpjHy/DojhiYqFAorOXdRAX Q8fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=bk877dvO; 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 u18-20020a170903125200b00178a9b343f5si396865plh.16.2022.09.19.20.03.44; Mon, 19 Sep 2022 20:03:58 -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=bk877dvO; 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 S230176AbiITC2I (ORCPT + 99 others); Mon, 19 Sep 2022 22:28:08 -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 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 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, 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!