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 F12C1C05027 for ; Tue, 14 Feb 2023 18:20:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232882AbjBNSUI (ORCPT ); Tue, 14 Feb 2023 13:20:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231147AbjBNSUG (ORCPT ); Tue, 14 Feb 2023 13:20:06 -0500 Received: from out-154.mta0.migadu.com (out-154.mta0.migadu.com [91.218.175.154]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D458422DEB for ; Tue, 14 Feb 2023 10:20:04 -0800 (PST) Date: Tue, 14 Feb 2023 10:19:55 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1676398802; 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=C03JB101UT4H7GXsm/C6IkusxIlv4b6qRP/hTE3sRrw=; b=Bv5XcO+rdFTP3ZnN/ef2zYIqnj4n/45vdztZ/CkPwQWTKKKfnChqo4ZpfafXPBeH7Tqga7 vDeT39iyRP4u0Cl1mu/mNk9l/M7NFw+2Um5VKY9LFye3hKu0qsl9HecKINPrOtiKmR0qlK XSOUYGZ5UNelDiqNCDXOReiZctJCrBY= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Muchun Song Cc: Andrew Morton , linux-kernel@vger.kernel.org, Johannes Weiner , Michal Hocko , Shakeel Butt , Dennis Zhou , Linux Memory Management List Subject: Re: [PATCH] mm: memcontrol: rename memcg_kmem_enabled() Message-ID: References: <20230213192922.1146370-1-roman.gushchin@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 14, 2023 at 11:54:35AM +0800, Muchun Song wrote: > > > > On Feb 14, 2023, at 03:29, Roman Gushchin wrote: > > > > Currently there are two kmem-related helper functions with a confusing > > semantics: memcg_kmem_enabled() and mem_cgroup_kmem_disabled(). > > > > The problem is that an obvious expectation > > memcg_kmem_enabled() == !mem_cgroup_kmem_disabled(), > > can be false. > > > > mem_cgroup_kmem_disabled() is similar to mem_cgroup_disabled(): it > > returns true only if CONFIG_MEMCG_KMEM is not set or the kmem > > accounting is disabled using a boot time kernel option > > "cgroup.memory=nokmem". It never changes the value dynamically. > > > > memcg_kmem_enabled() is different: it always returns false until > > the first non-root memory cgroup will get online (assuming the kernel > > memory accounting is enabled). It's goal is to improve the performance > > on systems without the cgroupfs mounted/memory controller enabled or > > on the systems with only the root memory cgroup. > > > > To make things more obvious and avoid potential bugs, let's rename > > memcg_kmem_enabled() to memcg_kmem_online(). > > > > Signed-off-by: Roman Gushchin > > It's more clear. > > Acked-by: Muchun Song Thank you! > > BTW, I also dislike the name of mem_cgroup_kmem_disabled, it is not > harmonious with memcg_kmem_enabled since the prefix of one is "mem_cgroup", > another is "memcg". Maybe we could make them more consistent. Anyway, it > is not related to this patch. It's a pair to mem_cgroup_disabled(). Thanks!