diff mbox series

mm: memcg: move cgroup v1 oom handling code into memcontrol-v1.c: fixup

Message ID 20240704002712.2077812-1-roman.gushchin@linux.dev (mailing list archive)
State New
Headers show
Series mm: memcg: move cgroup v1 oom handling code into memcontrol-v1.c: fixup | expand

Commit Message

Roman Gushchin July 4, 2024, 12:27 a.m. UTC
This is a small fixup for the commit
"mm: memcg: move cgroup v1 oom handling code into memcontrol-v1.c".

I forgot to actually move two functions mem_cgroup_node_nr_lru_pages()
and mem_cgroup_nr_lru_pages() into mm/memcontrol-v1.c, so that they remain
in mm/memcontrol.c and their commented out duplicated versions in
mm/memcontrol-v1.c.

Andrew, can you, please, squash it into the original commit?

I checked that the rest of mm-unstable tree can be rebased
automatically without any merge conflicts.

Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
---
 mm/memcontrol-v1.c | 74 +++++++++++++++++++++++-----------------------
 mm/memcontrol-v1.h |  5 ----
 mm/memcontrol.c    | 38 ------------------------
 3 files changed, 37 insertions(+), 80 deletions(-)

Comments

Andrew Morton July 4, 2024, 1:52 a.m. UTC | #1
On Thu,  4 Jul 2024 00:27:12 +0000 Roman Gushchin <roman.gushchin@linux.dev> wrote:

> This is a small fixup for the commit
> "mm: memcg: move cgroup v1 oom handling code into memcontrol-v1.c".
> 
> I forgot to actually move two functions mem_cgroup_node_nr_lru_pages()
> and mem_cgroup_nr_lru_pages() into mm/memcontrol-v1.c, so that they remain
> in mm/memcontrol.c and their commented out duplicated versions in
> mm/memcontrol-v1.c.
> 
> Andrew, can you, please, squash it into the original commit?
> 

Seems this wants to live behind "mm: memcg: move cgroup v1 interface
files to memcontrol-v1.c" so that's where I placed it.
Roman Gushchin July 4, 2024, 2:06 a.m. UTC | #2
On Wed, Jul 03, 2024 at 06:52:50PM -0700, Andrew Morton wrote:
> On Thu,  4 Jul 2024 00:27:12 +0000 Roman Gushchin <roman.gushchin@linux.dev> wrote:
> 
> > This is a small fixup for the commit
> > "mm: memcg: move cgroup v1 oom handling code into memcontrol-v1.c".
> > 
> > I forgot to actually move two functions mem_cgroup_node_nr_lru_pages()
> > and mem_cgroup_nr_lru_pages() into mm/memcontrol-v1.c, so that they remain
> > in mm/memcontrol.c and their commented out duplicated versions in
> > mm/memcontrol-v1.c.
> > 
> > Andrew, can you, please, squash it into the original commit?
> > 
> 
> Seems this wants to live behind "mm: memcg: move cgroup v1 interface
> files to memcontrol-v1.c" so that's where I placed it.

Right, this is the proper place for it.

Thank you!
diff mbox series

Patch

diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c
index 42829cbf7b48..597b03ee9e35 100644
--- a/mm/memcontrol-v1.c
+++ b/mm/memcontrol-v1.c
@@ -2494,43 +2494,43 @@  static ssize_t mem_cgroup_reset(struct kernfs_open_file *of, char *buf,
 #define LRU_ALL_ANON (BIT(LRU_INACTIVE_ANON) | BIT(LRU_ACTIVE_ANON))
 #define LRU_ALL	     ((1 << NR_LRU_LISTS) - 1)
 
-/* static unsigned long mem_cgroup_node_nr_lru_pages(struct mem_cgroup *memcg, */
-/* 				int nid, unsigned int lru_mask, bool tree) */
-/* { */
-/* 	struct lruvec *lruvec = mem_cgroup_lruvec(memcg, NODE_DATA(nid)); */
-/* 	unsigned long nr = 0; */
-/* 	enum lru_list lru; */
-
-/* 	VM_BUG_ON((unsigned)nid >= nr_node_ids); */
-
-/* 	for_each_lru(lru) { */
-/* 		if (!(BIT(lru) & lru_mask)) */
-/* 			continue; */
-/* 		if (tree) */
-/* 			nr += lruvec_page_state(lruvec, NR_LRU_BASE + lru); */
-/* 		else */
-/* 			nr += lruvec_page_state_local(lruvec, NR_LRU_BASE + lru); */
-/* 	} */
-/* 	return nr; */
-/* } */
-
-/* static unsigned long mem_cgroup_nr_lru_pages(struct mem_cgroup *memcg, */
-/* 					     unsigned int lru_mask, */
-/* 					     bool tree) */
-/* { */
-/* 	unsigned long nr = 0; */
-/* 	enum lru_list lru; */
-
-/* 	for_each_lru(lru) { */
-/* 		if (!(BIT(lru) & lru_mask)) */
-/* 			continue; */
-/* 		if (tree) */
-/* 			nr += memcg_page_state(memcg, NR_LRU_BASE + lru); */
-/* 		else */
-/* 			nr += memcg_page_state_local(memcg, NR_LRU_BASE + lru); */
-/* 	} */
-/* 	return nr; */
-/* } */
+static unsigned long mem_cgroup_node_nr_lru_pages(struct mem_cgroup *memcg,
+				int nid, unsigned int lru_mask, bool tree)
+{
+	struct lruvec *lruvec = mem_cgroup_lruvec(memcg, NODE_DATA(nid));
+	unsigned long nr = 0;
+	enum lru_list lru;
+
+	VM_BUG_ON((unsigned)nid >= nr_node_ids);
+
+	for_each_lru(lru) {
+		if (!(BIT(lru) & lru_mask))
+			continue;
+		if (tree)
+			nr += lruvec_page_state(lruvec, NR_LRU_BASE + lru);
+		else
+			nr += lruvec_page_state_local(lruvec, NR_LRU_BASE + lru);
+	}
+	return nr;
+}
+
+static unsigned long mem_cgroup_nr_lru_pages(struct mem_cgroup *memcg,
+					     unsigned int lru_mask,
+					     bool tree)
+{
+	unsigned long nr = 0;
+	enum lru_list lru;
+
+	for_each_lru(lru) {
+		if (!(BIT(lru) & lru_mask))
+			continue;
+		if (tree)
+			nr += memcg_page_state(memcg, NR_LRU_BASE + lru);
+		else
+			nr += memcg_page_state_local(memcg, NR_LRU_BASE + lru);
+	}
+	return nr;
+}
 
 static int memcg_numa_stat_show(struct seq_file *m, void *v)
 {
diff --git a/mm/memcontrol-v1.h b/mm/memcontrol-v1.h
index 7be4670d9abb..0a4d5092c51b 100644
--- a/mm/memcontrol-v1.h
+++ b/mm/memcontrol-v1.h
@@ -88,11 +88,6 @@  void memcg1_oom_finish(struct mem_cgroup *memcg, bool locked);
 void memcg1_oom_recover(struct mem_cgroup *memcg);
 
 void drain_all_stock(struct mem_cgroup *root_memcg);
-unsigned long mem_cgroup_nr_lru_pages(struct mem_cgroup *memcg,
-				      unsigned int lru_mask, bool tree);
-unsigned long mem_cgroup_node_nr_lru_pages(struct mem_cgroup *memcg,
-					   int nid, unsigned int lru_mask,
-					   bool tree);
 
 unsigned long memcg_events(struct mem_cgroup *memcg, int event);
 unsigned long memcg_events_local(struct mem_cgroup *memcg, int event);
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 11e4a3c65437..f35ed6655992 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3188,44 +3188,6 @@  static void memcg_offline_kmem(struct mem_cgroup *memcg)
 }
 #endif /* CONFIG_MEMCG_KMEM */
 
-unsigned long mem_cgroup_node_nr_lru_pages(struct mem_cgroup *memcg,
-					   int nid, unsigned int lru_mask,
-					   bool tree)
-{
-	struct lruvec *lruvec = mem_cgroup_lruvec(memcg, NODE_DATA(nid));
-	unsigned long nr = 0;
-	enum lru_list lru;
-
-	VM_BUG_ON((unsigned)nid >= nr_node_ids);
-
-	for_each_lru(lru) {
-		if (!(BIT(lru) & lru_mask))
-			continue;
-		if (tree)
-			nr += lruvec_page_state(lruvec, NR_LRU_BASE + lru);
-		else
-			nr += lruvec_page_state_local(lruvec, NR_LRU_BASE + lru);
-	}
-	return nr;
-}
-
-unsigned long mem_cgroup_nr_lru_pages(struct mem_cgroup *memcg,
-				      unsigned int lru_mask, bool tree)
-{
-	unsigned long nr = 0;
-	enum lru_list lru;
-
-	for_each_lru(lru) {
-		if (!(BIT(lru) & lru_mask))
-			continue;
-		if (tree)
-			nr += memcg_page_state(memcg, NR_LRU_BASE + lru);
-		else
-			nr += memcg_page_state_local(memcg, NR_LRU_BASE + lru);
-	}
-	return nr;
-}
-
 #ifdef CONFIG_CGROUP_WRITEBACK
 
 #include <trace/events/writeback.h>