From patchwork Tue Nov 9 13:33:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12610749 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 A1C0FC433FE for ; Tue, 9 Nov 2021 13:41:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 223FE611C4 for ; Tue, 9 Nov 2021 13:41:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 223FE611C4 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 63B096B0071; Tue, 9 Nov 2021 08:41:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E8FC6B0073; Tue, 9 Nov 2021 08:41:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4B1DD6B0075; Tue, 9 Nov 2021 08:41:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0109.hostedemail.com [216.40.44.109]) by kanga.kvack.org (Postfix) with ESMTP id 3E43D6B0071 for ; Tue, 9 Nov 2021 08:41:30 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 001DD7BE48 for ; Tue, 9 Nov 2021 13:41:29 +0000 (UTC) X-FDA: 78789503940.24.C4DAA2A Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by imf03.hostedemail.com (Postfix) with ESMTP id 1927A3001A14 for ; Tue, 9 Nov 2021 13:41:21 +0000 (UTC) Received: by mail-pl1-f174.google.com with SMTP id p18so20899688plf.13 for ; Tue, 09 Nov 2021 05:41:27 -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=JGckYCKC3QkdmorCQBrCITV0xuJTY6O9SwWg8mL+BdQ=; b=6qbp9Ok8iGuglDC2shThRhER8hbZ8e0LEw0xFTjjSyMm8o877uHQg+ZRvG69MyHnq9 HDlcrWjwFoDWE5cFGRO+H28PW8JbmP2vwYANGr2LbwIsxRzUtaEJwJET5AhwCiKwjJpN iIYZAkAwL0l8W373vktB/e/pGVcXBRZzjXqg39H9gaWiwBp6dxTCiTemCJ1/fTx20iPU aEDVSj/SFCxSPSiZKXJ+ZpDQ7+3sgPRSjf51y5YQRkUofRyrC5g0UCbRcagVO1sKXOyb uEuKNERuIXW4Sq5mjq3JfCmXPdx+X2ENAAxeThIqkm7Ms6xId7oopOQMjRtkxTRa2m5q Z8+A== 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=JGckYCKC3QkdmorCQBrCITV0xuJTY6O9SwWg8mL+BdQ=; b=lU3O6ORLGvaRzjs/fl7C0h4IZcgfRpZUe0KQgvacDawiGuh0He/VSQrcss/2MnMr7h 5UAgFWyTqLs5A+Y1eBBKiiYwr8p2dzdkx3v75lafTyQ5vHWWfKdnWmRPXJwYu9rbQtpZ ieYP+o/jcwbTYdj5TQtYS5jwHzHEwxtB6sToiTUCOMYapD1r5hDM4JzlSwFOUBnWCwp9 g8O7MSnuTec8nIBtsyJYRdPUzInFelUiLqbyfN0fjVIsz+aQyF4gobapuUyYjjCimAjZ EC6Bbfdhp37U+JMhkcHjcFG8zZm6DHMh99RDe4SQqpVBqwlUQElOsk3fY5lnnGgfEFp8 09eQ== X-Gm-Message-State: AOAM532Qjof6SHUTyEptPtMwac5zqVB8BrOxPDjkvdn+SaJAm1vLYy9c vnlunZUp4AwRQEmtITNzRoT/Eg== X-Google-Smtp-Source: ABdhPJwdT1FNusiCu32EShNsahIaRfVcIi6gvq8fqlCOCStKk0kdkAQx4Z7eIF0WDIHynJXYeEKXlA== X-Received: by 2002:a17:90a:9606:: with SMTP id v6mr7179188pjo.27.1636465286239; Tue, 09 Nov 2021 05:41:26 -0800 (PST) Received: from localhost.localdomain ([139.177.225.240]) by smtp.gmail.com with ESMTPSA id k7sm16489930pgn.47.2021.11.09.05.41.21 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Nov 2021 05:41:25 -0800 (PST) From: Muchun Song To: hannes@cmpxchg.org, mhocko@kernel.org, vdavydov.dev@gmail.com, akpm@linux-foundation.org, cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, vbabka@suse.cz Cc: cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Muchun Song Subject: [PATCH] mm: slab: make slab iterator functions static Date: Tue, 9 Nov 2021 21:33:59 +0800 Message-Id: <20211109133359.32881-1-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) MIME-Version: 1.0 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 1927A3001A14 X-Stat-Signature: xa7fp6izk7fotps75no6yc6juipxp48n Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=6qbp9Ok8; spf=pass (imf03.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.214.174 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-HE-Tag: 1636465281-50536 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: There is no external users of slab_start/next/stop(), so make them static. And the memory.kmem.slabinfo is deprecated, which outputs nothing now, so move memcg_slab_show() into mm/memcontrol.c and rename it to mem_cgroup_slab_show to be consistent with other function names. Signed-off-by: Muchun Song Reviewed-by: Vlastimil Babka --- mm/memcontrol.c | 13 ++++++++++++- mm/slab.h | 5 ----- mm/slab_common.c | 17 +++-------------- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 781605e92015..8d63d4feaf6a 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -4845,6 +4845,17 @@ static ssize_t memcg_write_event_control(struct kernfs_open_file *of, return ret; } +#if defined(CONFIG_MEMCG_KMEM) && (defined(CONFIG_SLAB) || defined(CONFIG_SLUB_DEBUG)) +static int mem_cgroup_slab_show(struct seq_file *m, void *p) +{ + /* + * Deprecated. + * Please, take a look at tools/cgroup/slabinfo.py . + */ + return 0; +} +#endif + static struct cftype mem_cgroup_legacy_files[] = { { .name = "usage_in_bytes", @@ -4945,7 +4956,7 @@ static struct cftype mem_cgroup_legacy_files[] = { (defined(CONFIG_SLAB) || defined(CONFIG_SLUB_DEBUG)) { .name = "kmem.slabinfo", - .seq_show = memcg_slab_show, + .seq_show = mem_cgroup_slab_show, }, #endif { diff --git a/mm/slab.h b/mm/slab.h index 58c01a34e5b8..bf930ba8774d 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -575,11 +575,6 @@ static inline struct kmem_cache_node *get_node(struct kmem_cache *s, int node) #endif -void *slab_start(struct seq_file *m, loff_t *pos); -void *slab_next(struct seq_file *m, void *p, loff_t *pos); -void slab_stop(struct seq_file *m, void *p); -int memcg_slab_show(struct seq_file *m, void *p); - #if defined(CONFIG_SLAB) || defined(CONFIG_SLUB_DEBUG) void dump_unreclaimable_slab(void); #else diff --git a/mm/slab_common.c b/mm/slab_common.c index e5d080a93009..3a5cad207a49 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -1044,18 +1044,18 @@ static void print_slabinfo_header(struct seq_file *m) seq_putc(m, '\n'); } -void *slab_start(struct seq_file *m, loff_t *pos) +static void *slab_start(struct seq_file *m, loff_t *pos) { mutex_lock(&slab_mutex); return seq_list_start(&slab_caches, *pos); } -void *slab_next(struct seq_file *m, void *p, loff_t *pos) +static void *slab_next(struct seq_file *m, void *p, loff_t *pos) { return seq_list_next(p, &slab_caches, pos); } -void slab_stop(struct seq_file *m, void *p) +static void slab_stop(struct seq_file *m, void *p) { mutex_unlock(&slab_mutex); } @@ -1123,17 +1123,6 @@ void dump_unreclaimable_slab(void) mutex_unlock(&slab_mutex); } -#if defined(CONFIG_MEMCG_KMEM) -int memcg_slab_show(struct seq_file *m, void *p) -{ - /* - * Deprecated. - * Please, take a look at tools/cgroup/slabinfo.py . - */ - return 0; -} -#endif - /* * slabinfo_op - iterator that generates /proc/slabinfo *