From patchwork Tue Nov 9 06:54:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12609825 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97A16C433F5 for ; Tue, 9 Nov 2021 06:57:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EB6766112D for ; Tue, 9 Nov 2021 06:57:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EB6766112D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 832946B00DD; Tue, 9 Nov 2021 01:57:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7E02F6B00DF; Tue, 9 Nov 2021 01:57:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6CF446B00E0; Tue, 9 Nov 2021 01:57:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0126.hostedemail.com [216.40.44.126]) by kanga.kvack.org (Postfix) with ESMTP id 5E48E6B00DD for ; Tue, 9 Nov 2021 01:57:07 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 0DA281846CAD5 for ; Tue, 9 Nov 2021 06:57:07 +0000 (UTC) X-FDA: 78788484894.28.D1EE434 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by imf01.hostedemail.com (Postfix) with ESMTP id 836D35099254 for ; Tue, 9 Nov 2021 06:56:52 +0000 (UTC) Received: by mail-pl1-f181.google.com with SMTP id u17so19190799plg.9 for ; Mon, 08 Nov 2021 22:57:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/XKMtNbhHard2yRQO8rFCjh0jyp/6c/s8q/mjmligM4=; b=aTp8Ll68DWdBAxBxCtQdANLlQKWtuEhwd0/T75cnUywhLq1CyenVIITsPjrA8sFYT7 83PuMbn20BeizsO2YvQkQmA/r3GS752EFHleaeSWbCjJCdp1YOS16rqbzedjbtMPmi9A 7hbYkHeMfVi1WOtipvn2NaV2W4z7LuFjzFHIoe08KIWKCV6bEtDk/AciN4XCRX/z+U4f 05GZEwCibES9syHsUsdI9UmR5PGvOqErB8iWq30DNe6/YycSul0ZDNnV1GF/ztKV6anN ppoNFGR/Pt5WDiabL5rUUhQTb1fshGQLUtKQPv2D0DHkybiX9SN6QDkHGnc/xZq4l4WB OX7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/XKMtNbhHard2yRQO8rFCjh0jyp/6c/s8q/mjmligM4=; b=IdIfGoI0Hhk/6D7NePHDUW48d9W/tZUkQ3iNetEkvMA+tyw8kaSv1v9bFZjpOG/AGH DVBXuuEglEbPM8A59ZykArwixACl5MRD3w6W4BbRQzclRpo3zjD6n2Rzhd2fmc9rrDfV egLKWVjBr1MxsRDADJf7x3piI9q5PKZ1ibSQi/zK+vF+DAhGcnJIoqUJw5vIWoeVo250 YXy0j0VcMXLDhcRYtGX2PiLYVDfjYrDb5GoNZW7szUe09sXp5bnPKo+5OgxoD0YNtPMn TEG+XXkA51H9PNuDAQVXtk2p4iJZ1lJ2xNQ04f3TLaeJ71mqKtwcXlGGc5OzOkwzHA+K it1Q== X-Gm-Message-State: AOAM532ClQ25Zlw7S85jzKxF34zVc04djv8B7N2WyvZE9/uFlDy+IgYM e/8UmGs8VehUI4qhnU2tGUJAXQ== X-Google-Smtp-Source: ABdhPJyDQ8G3NeijGvDl3KVdjcylGfSlt21ZkJwtfAZgL5mIAc9E5GrN9dsW6AZI+zEy2W682XpfLw== X-Received: by 2002:a17:902:900c:b0:13f:974c:19b0 with SMTP id a12-20020a170902900c00b0013f974c19b0mr4936931plp.12.1636441024400; Mon, 08 Nov 2021 22:57:04 -0800 (PST) Received: from localhost.localdomain ([139.177.225.240]) by smtp.gmail.com with ESMTPSA id 142sm14254104pgh.22.2021.11.08.22.57.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Nov 2021 22:57:04 -0800 (PST) From: Muchun Song To: akpm@linux-foundation.org, hannes@cmpxchg.org, mhocko@kernel.org, vdavydov.dev@gmail.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Muchun Song Subject: [PATCH] mm: memcontrol: make cgroup_memory_nokmem static Date: Tue, 9 Nov 2021 14:54:18 +0800 Message-Id: <20211109065418.21693-1-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 836D35099254 X-Stat-Signature: w1bp7eoc3nhgtngzqz696gufhw3yim35 Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=aTp8Ll68; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf01.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.214.181 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com X-HE-Tag: 1636441012-303220 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: The commit 494c1dfe855e ("mm: memcg/slab: create a new set of kmalloc-cg- caches") makes cgroup_memory_nokmem global, however, it is unnecessary because there is already a function mem_cgroup_kmem_disabled() which exports it. Just make it static and replace it with mem_cgroup_kmem_disabled() in mm/slab_common.c. Signed-off-by: Muchun Song Acked-by: Chris Down Acked-by: Vlastimil Babka --- mm/internal.h | 5 ----- mm/memcontrol.c | 2 +- mm/slab_common.c | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/mm/internal.h b/mm/internal.h index 18256e32a14c..ad15251d7a3c 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -137,11 +137,6 @@ extern void putback_lru_page(struct page *page); extern pmd_t *mm_find_pmd(struct mm_struct *mm, unsigned long address); /* - * in mm/memcontrol.c: - */ -extern bool cgroup_memory_nokmem; - -/* * in mm/page_alloc.c */ diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 8f1d9c028897..89fc3ca65b2d 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -84,7 +84,7 @@ EXPORT_PER_CPU_SYMBOL_GPL(int_active_memcg); static bool cgroup_memory_nosocket __ro_after_init; /* Kernel memory accounting disabled? */ -bool cgroup_memory_nokmem __ro_after_init; +static bool cgroup_memory_nokmem __ro_after_init; /* Whether the swap controller is active */ #ifdef CONFIG_MEMCG_SWAP diff --git a/mm/slab_common.c b/mm/slab_common.c index e5d080a93009..d05203a11201 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -849,7 +849,7 @@ new_kmalloc_cache(int idx, enum kmalloc_cache_type type, slab_flags_t flags) if (type == KMALLOC_RECLAIM) { flags |= SLAB_RECLAIM_ACCOUNT; } else if (IS_ENABLED(CONFIG_MEMCG_KMEM) && (type == KMALLOC_CGROUP)) { - if (cgroup_memory_nokmem) { + if (mem_cgroup_kmem_disabled()) { kmalloc_caches[type][idx] = kmalloc_caches[KMALLOC_NORMAL][idx]; return; }