From patchwork Fri Jan 17 01:46:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Ridong X-Patchwork-Id: 13942783 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8230C02183 for ; Fri, 17 Jan 2025 01:57:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5B26B6B0093; Thu, 16 Jan 2025 20:57:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5654C6B0088; Thu, 16 Jan 2025 20:57:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 369C96B0093; Thu, 16 Jan 2025 20:57:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 114C26B0085 for ; Thu, 16 Jan 2025 20:57:44 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B801FB10F5 for ; Fri, 17 Jan 2025 01:57:43 +0000 (UTC) X-FDA: 83015282406.27.647D4D9 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by imf24.hostedemail.com (Postfix) with ESMTP id 201C4180004 for ; Fri, 17 Jan 2025 01:57:38 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=none; spf=pass (imf24.hostedemail.com: domain of chenridong@huaweicloud.com designates 45.249.212.51 as permitted sender) smtp.mailfrom=chenridong@huaweicloud.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1737079062; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ofYV2Voduavy/Nz9tPCRlp5NZ9NgfHZOoHuPJiDoAR4=; b=mFiYBgg0SYO8ihyuc/QgD//kf+sbeLPkmpxLeQz49E7DaT/4H7soEJINRvMoziZTfXV4y5 vhWHVkfSbmgaIgf53AZhe739gwKTDHg2UEhGdX/kk+S7aJ9HcF/WxeEE3NZCfTYL1Dsa8m 489AkaTrsIlFH/cS/iGz+UTC1tc2jKU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1737079062; a=rsa-sha256; cv=none; b=j3mLQfPTSMhfLXISeYsUkZWUalcmqfYo1UWP46u/3Re0XNsb+BVQGlGey4O1G9HWgA7dpe WjJY5qy3gtTFDQA0OS+r3d3uCBvPrwVDwHJKSqmYCj4ptb7QxOW3Tem8eewXmveODZHTEu bcp8fAW3WjVF6kb9ZBRI1bmOyvRUbwg= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=none; spf=pass (imf24.hostedemail.com: domain of chenridong@huaweicloud.com designates 45.249.212.51 as permitted sender) smtp.mailfrom=chenridong@huaweicloud.com; dmarc=none Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4YZ2t70L0rz4f3jt6 for ; Fri, 17 Jan 2025 09:57:19 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.75]) by mail.maildlp.com (Postfix) with ESMTP id 4FC6C1A119B for ; Fri, 17 Jan 2025 09:57:34 +0800 (CST) Received: from hulk-vt.huawei.com (unknown [10.67.174.121]) by APP2 (Coremail) with SMTP id Syh0CgCnsWT7uIln8NWrBA--.20802S7; Fri, 17 Jan 2025 09:57:34 +0800 (CST) From: Chen Ridong To: akpm@linux-foundation.org, mhocko@kernel.org, hannes@cmpxchg.org, yosryahmed@google.com, roman.gushchin@linux.dev, shakeel.butt@linux.dev, muchun.song@linux.dev, davidf@vimeo.com, vbabka@suse.cz, mkoutny@suse.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, chenridong@huawei.com, wangweiyang2@huawei.com Subject: [PATCH v3 next 5/5] memcg: move the 'local' functions to memcontrol-v1.c Date: Fri, 17 Jan 2025 01:46:45 +0000 Message-Id: <20250117014645.1673127-6-chenridong@huaweicloud.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250117014645.1673127-1-chenridong@huaweicloud.com> References: <20250117014645.1673127-1-chenridong@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: Syh0CgCnsWT7uIln8NWrBA--.20802S7 X-Coremail-Antispam: 1UD129KBjvJXoWxWr4Dur4rJr4UCryUtFyUGFg_yoWrGryUpF n3Ga13Kw47Jw45WF1akFyUu3s3Zw1fXrW5t3yxt34xZa43twn0gasIgrZ8ZrW5GrWFqFsx J3yYyr1kJ3yUtaUanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPSb4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUAV Cq3wA2048vs2IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0 rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0cI8IcVCY1x0267 AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E 14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7 xfMcIj6xIIjxv20xvE14v26r106r15McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Y z7v_Jr0_Gr1lF7xvr2IYc2Ij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ulD+OdEYyYL5YbCVRL3lE6vUK08RWyokXGkF57g3jnwDttJNYTafnfGjhUGLwygFqAHW1rU7L5IfDy/TFzIwfEyIa0nuz8WGMl22V3IQOZ8KLgv8Qtocc9oTqhvg+O529UHkMPhw6j2R3TNOK6NJREuggkfFmfXcadsJfEnB7V28FSJU3OkpwfffmXKjvqQw/sXTi7/HXj3dr6H1pjWSNu2poSCm9HKno4zcxDxLnJL7UAwKf8+1RBZbXO9nH/8HAHV7ilOkDKxdrnyvkMU+qUhF9CsvtWOn1D1cVnX6X1zaWRMOGg7N5eBhy5OoRgfhL/EKTu60zAjVaVOSlJTPjF3mUa2rcDyCCqOSJwXpcP9hoI+dSpscryQx6zMgPXlNUTrR95EB/VuBOd5CVn849Gc1x30zvn+EzFBavBMy3HcQrcLon/yI8g47B0M4pLOAC/3I85LsE1mb/YjFhlLzbeCGfqONJgl2yyfeK0y pgpom8IN KVe57BmunLGG5935kekGEXy2Ph589Q75RnIfhwB2YEjFpFpbas/skILjL/cS/RntE4/N0G7K27DUBy+MeW88qAc2njtXdixtAjnnW8AORbykhQbsv5pn6Pyhjru+mp80WTb1B 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: List-Subscribe: List-Unsubscribe: From: Chen Ridong Move the 'local' functions, which are only used in memcg v1, to the memcontrol-v1.c. Signed-off-by: Chen Ridong Acked-by: Johannes Weiner --- include/linux/memcontrol.h | 6 ------ mm/memcontrol-v1.c | 17 +++++++++++++++++ mm/memcontrol-v1.h | 7 +------ mm/memcontrol.c | 8 +------- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index ec469c5f7491..6895b2958835 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -938,12 +938,6 @@ static inline void mod_memcg_page_state(struct page *page, unsigned long __memcg_page_state(struct mem_cgroup *memcg, int idx, bool local); -/* idx can be of type enum memcg_stat_item or node_stat_item. */ -static inline unsigned long memcg_page_state_local(struct mem_cgroup *memcg, int idx) -{ - return __memcg_page_state(memcg, idx, true); -} - static inline unsigned long memcg_page_state(struct mem_cgroup *memcg, int idx) { return __memcg_page_state(memcg, idx, false); diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c index 2be6b9112808..2e8529b63366 100644 --- a/mm/memcontrol-v1.c +++ b/mm/memcontrol-v1.c @@ -106,6 +106,23 @@ static struct lockdep_map memcg_oom_lock_dep_map = { DEFINE_SPINLOCK(memcg_oom_lock); +static unsigned long memcg_events_local(struct mem_cgroup *memcg, int event) +{ + return __memcg_events(memcg, event, true); +} + +/* idx can be of type enum memcg_stat_item or node_stat_item. */ +static unsigned long memcg_page_state_local(struct mem_cgroup *memcg, int idx) +{ + return __memcg_page_state(memcg, idx, true); +} + +static unsigned long memcg_page_state_local_output(struct mem_cgroup *memcg, int item) +{ + return memcg_page_state_local(memcg, item) * + memcg_page_state_output_unit(item); +} + static void __mem_cgroup_insert_exceeded(struct mem_cgroup_per_node *mz, struct mem_cgroup_tree_per_node *mctz, unsigned long new_usage_in_excess) diff --git a/mm/memcontrol-v1.h b/mm/memcontrol-v1.h index f68c0064d674..d76e9a47adaa 100644 --- a/mm/memcontrol-v1.h +++ b/mm/memcontrol-v1.h @@ -65,13 +65,8 @@ static inline unsigned long memcg_events(struct mem_cgroup *memcg, int event) return __memcg_events(memcg, event, false); } -static inline unsigned long memcg_events_local(struct mem_cgroup *memcg, int event) -{ - return __memcg_events(memcg, event, true); -} - +int memcg_page_state_output_unit(int item); unsigned long memcg_page_state_output(struct mem_cgroup *memcg, int item); -unsigned long memcg_page_state_local_output(struct mem_cgroup *memcg, int item); int memory_stat_show(struct seq_file *m, void *v); /* Cgroup v1-specific declarations */ diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 404bbdfa352f..3f32d4ab55b3 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1367,7 +1367,7 @@ static int memcg_page_state_unit(int item) } /* Translate stat items to the correct unit for memory.stat output */ -static int memcg_page_state_output_unit(int item) +int memcg_page_state_output_unit(int item) { /* * Workingset state is actually in pages, but we export it to userspace @@ -1402,12 +1402,6 @@ unsigned long memcg_page_state_output(struct mem_cgroup *memcg, int item) memcg_page_state_output_unit(item); } -unsigned long memcg_page_state_local_output(struct mem_cgroup *memcg, int item) -{ - return memcg_page_state_local(memcg, item) * - memcg_page_state_output_unit(item); -} - #ifdef CONFIG_HUGETLB_PAGE static bool memcg_accounts_hugetlb(void) {