lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250117014645.1673127-6-chenridong@huaweicloud.com>
Date: Fri, 17 Jan 2025 01:46:45 +0000
From: Chen Ridong <chenridong@...weicloud.com>
To: akpm@...ux-foundation.org,
	mhocko@...nel.org,
	hannes@...xchg.org,
	yosryahmed@...gle.com,
	roman.gushchin@...ux.dev,
	shakeel.butt@...ux.dev,
	muchun.song@...ux.dev,
	davidf@...eo.com,
	vbabka@...e.cz,
	mkoutny@...e.com
Cc: linux-mm@...ck.org,
	linux-kernel@...r.kernel.org,
	cgroups@...r.kernel.org,
	chenridong@...wei.com,
	wangweiyang2@...wei.com
Subject: [PATCH v3 next 5/5] memcg: move the 'local' functions to memcontrol-v1.c

From: Chen Ridong <chenridong@...wei.com>

Move the 'local' functions, which are only used in memcg v1, to the
memcontrol-v1.c.

Signed-off-by: Chen Ridong <chenridong@...wei.com>
---
 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)
 {
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ