From: Chen Ridong <chenridong@huawei.com>
Move the 'local' functions, which are only used in memcg v1, to the
memcontrol-v1.c.
Signed-off-by: Chen Ridong <chenridong@huawei.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