All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/9] Convert all THP vmstat counters to pages
@ 2020-12-05 13:02 Muchun Song
  2020-12-05 13:02 ` [PATCH 1/9] mm: vmstat: fix stat_threshold for NR_KERNEL_STACK_KB Muchun Song
                   ` (8 more replies)
  0 siblings, 9 replies; 31+ messages in thread
From: Muchun Song @ 2020-12-05 13:02 UTC (permalink / raw)
  To: gregkh, rafael, adobriyan, akpm, hannes, mhocko, vdavydov.dev,
	hughd, will, guro, rppt, tglx, esyr, peterx, krisman, surenb,
	avagin, elver, rdunlap, iamjoonsoo.kim
  Cc: linux-kernel, linux-fsdevel, linux-mm, cgroups, Muchun Song

Hi,

This patch series is aimed to convert all THP vmstat counters to pages
and the kernel stack vmstat counter to bytes.

The unit of some vmstat counters are pages, the unit of some vmstat counters
are bytes, the unit of some vmstat counters are HPAGE_PMD_NR, and the unit
of some vmstat counters are KiB. When we want to expose these vmstat counters
to the userspace, we have to know the unit of the vmstat counters is which
one. It makes the code complex.

This patch series can make the code simple. And the unit of the vmstat
counters are either pages or bytes.

This was inspired by Johannes and Roman. Thanks to them.

Muchun Song (9):
  mm: vmstat: fix stat_threshold for NR_KERNEL_STACK_KB
  mm: memcontrol: fix NR_ANON_THPS account
  mm: memcontrol: convert kernel stack account to byte-sized
  mm: memcontrol: convert NR_ANON_THPS account to pages
  mm: memcontrol: convert NR_FILE_THPS account to pages
  mm: memcontrol: convert NR_SHMEM_THPS account to pages
  mm: memcontrol: convert NR_SHMEM_PMDMAPPED account to pages
  mm: memcontrol: convert NR_FILE_PMDMAPPED account to pages
  mm: memcontrol: make the slab calculation consistent

 drivers/base/node.c    |  17 +++---
 fs/proc/meminfo.c      |  12 ++---
 include/linux/mmzone.h |   2 +-
 kernel/fork.c          |   8 +--
 mm/filemap.c           |   4 +-
 mm/huge_memory.c       |   9 ++--
 mm/khugepaged.c        |   4 +-
 mm/memcontrol.c        | 139 +++++++++++++++++++++++++------------------------
 mm/page_alloc.c        |   9 ++--
 mm/rmap.c              |  19 ++++---
 mm/shmem.c             |   3 +-
 mm/vmstat.c            |   4 ++
 12 files changed, 120 insertions(+), 110 deletions(-)

-- 
2.11.0


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 1/9] mm: vmstat: fix stat_threshold for NR_KERNEL_STACK_KB
  2020-12-05 13:02 [PATCH 0/9] Convert all THP vmstat counters to pages Muchun Song
@ 2020-12-05 13:02 ` Muchun Song
  2020-12-05 13:02 ` [PATCH 2/9] mm: memcontrol: fix NR_ANON_THPS account Muchun Song
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 31+ messages in thread
From: Muchun Song @ 2020-12-05 13:02 UTC (permalink / raw)
  To: gregkh, rafael, adobriyan, akpm, hannes, mhocko, vdavydov.dev,
	hughd, will, guro, rppt, tglx, esyr, peterx, krisman, surenb,
	avagin, elver, rdunlap, iamjoonsoo.kim
  Cc: linux-kernel, linux-fsdevel, linux-mm, cgroups, Muchun Song

The kernel stack is being accounted in KiB not page, so the
stat_threshold should also adjust to byte.

Signed-off-by: Muchun Song <songmuchun@bytedance.com>
---
 mm/vmstat.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mm/vmstat.c b/mm/vmstat.c
index 8d77ee426e22..f7857a7052e4 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -353,6 +353,8 @@ void __mod_node_page_state(struct pglist_data *pgdat, enum node_stat_item item,
 	x = delta + __this_cpu_read(*p);
 
 	t = __this_cpu_read(pcp->stat_threshold);
+	if (unlikely(item == NR_KERNEL_STACK_KB))
+		t <<= PAGE_SHIFT;
 
 	if (unlikely(abs(x) > t)) {
 		node_page_state_add(x, pgdat, item);
@@ -573,6 +575,8 @@ static inline void mod_node_state(struct pglist_data *pgdat,
 		 * for all cpus in a node.
 		 */
 		t = this_cpu_read(pcp->stat_threshold);
+		if (unlikely(item == NR_KERNEL_STACK_KB))
+			t <<= PAGE_SHIFT;
 
 		o = this_cpu_read(*p);
 		n = delta + o;
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 2/9] mm: memcontrol: fix NR_ANON_THPS account
  2020-12-05 13:02 [PATCH 0/9] Convert all THP vmstat counters to pages Muchun Song
  2020-12-05 13:02 ` [PATCH 1/9] mm: vmstat: fix stat_threshold for NR_KERNEL_STACK_KB Muchun Song
@ 2020-12-05 13:02 ` Muchun Song
  2020-12-05 13:02 ` [PATCH 3/9] mm: memcontrol: convert kernel stack account to byte-sized Muchun Song
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 31+ messages in thread
From: Muchun Song @ 2020-12-05 13:02 UTC (permalink / raw)
  To: gregkh, rafael, adobriyan, akpm, hannes, mhocko, vdavydov.dev,
	hughd, will, guro, rppt, tglx, esyr, peterx, krisman, surenb,
	avagin, elver, rdunlap, iamjoonsoo.kim
  Cc: linux-kernel, linux-fsdevel, linux-mm, cgroups, Muchun Song

The unit of NR_ANON_THPS is HPAGE_PMD_NR already. So it should inc/dec
by one rather than nr_pages.

Fixes: 468c398233da ("mm: memcontrol: switch to native NR_ANON_THPS counter")
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
---
 mm/memcontrol.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 22d9bd688d6d..695dedf8687a 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5634,10 +5634,8 @@ static int mem_cgroup_move_account(struct page *page,
 			__mod_lruvec_state(from_vec, NR_ANON_MAPPED, -nr_pages);
 			__mod_lruvec_state(to_vec, NR_ANON_MAPPED, nr_pages);
 			if (PageTransHuge(page)) {
-				__mod_lruvec_state(from_vec, NR_ANON_THPS,
-						   -nr_pages);
-				__mod_lruvec_state(to_vec, NR_ANON_THPS,
-						   nr_pages);
+				__dec_lruvec_state(from_vec, NR_ANON_THPS);
+				__inc_lruvec_state(to_vec, NR_ANON_THPS);
 			}
 
 		}
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 3/9] mm: memcontrol: convert kernel stack account to byte-sized
  2020-12-05 13:02 [PATCH 0/9] Convert all THP vmstat counters to pages Muchun Song
  2020-12-05 13:02 ` [PATCH 1/9] mm: vmstat: fix stat_threshold for NR_KERNEL_STACK_KB Muchun Song
  2020-12-05 13:02 ` [PATCH 2/9] mm: memcontrol: fix NR_ANON_THPS account Muchun Song
@ 2020-12-05 13:02 ` Muchun Song
  2020-12-05 14:10   ` Greg KH
  2020-12-05 13:02   ` Muchun Song
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 31+ messages in thread
From: Muchun Song @ 2020-12-05 13:02 UTC (permalink / raw)
  To: gregkh, rafael, adobriyan, akpm, hannes, mhocko, vdavydov.dev,
	hughd, will, guro, rppt, tglx, esyr, peterx, krisman, surenb,
	avagin, elver, rdunlap, iamjoonsoo.kim
  Cc: linux-kernel, linux-fsdevel, linux-mm, cgroups, Muchun Song

The kernel stack account is the only one that counts in KiB.
This patch convert it from KiB to byte.

Signed-off-by: Muchun Song <songmuchun@bytedance.com>
---
 drivers/base/node.c    | 2 +-
 fs/proc/meminfo.c      | 2 +-
 include/linux/mmzone.h | 2 +-
 kernel/fork.c          | 8 ++++----
 mm/memcontrol.c        | 2 +-
 mm/page_alloc.c        | 2 +-
 mm/vmstat.c            | 4 ++--
 7 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index 6ffa470e2984..855886a6ba0e 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -446,7 +446,7 @@ static ssize_t node_read_meminfo(struct device *dev,
 			     nid, K(node_page_state(pgdat, NR_FILE_MAPPED)),
 			     nid, K(node_page_state(pgdat, NR_ANON_MAPPED)),
 			     nid, K(i.sharedram),
-			     nid, node_page_state(pgdat, NR_KERNEL_STACK_KB),
+			     nid, node_page_state(pgdat, NR_KERNEL_STACK_B) / 1024,
 #ifdef CONFIG_SHADOW_CALL_STACK
 			     nid, node_page_state(pgdat, NR_KERNEL_SCS_KB),
 #endif
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index 887a5532e449..c396b6cfba82 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -101,7 +101,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
 	show_val_kb(m, "SReclaimable:   ", sreclaimable);
 	show_val_kb(m, "SUnreclaim:     ", sunreclaim);
 	seq_printf(m, "KernelStack:    %8lu kB\n",
-		   global_node_page_state(NR_KERNEL_STACK_KB));
+		   global_node_page_state(NR_KERNEL_STACK_B) / 1024);
 #ifdef CONFIG_SHADOW_CALL_STACK
 	seq_printf(m, "ShadowCallStack:%8lu kB\n",
 		   global_node_page_state(NR_KERNEL_SCS_KB));
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 15132adaa233..bd34416293ec 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -202,7 +202,7 @@ enum node_stat_item {
 	NR_KERNEL_MISC_RECLAIMABLE,	/* reclaimable non-slab kernel pages */
 	NR_FOLL_PIN_ACQUIRED,	/* via: pin_user_page(), gup flag: FOLL_PIN */
 	NR_FOLL_PIN_RELEASED,	/* pages returned via unpin_user_page() */
-	NR_KERNEL_STACK_KB,	/* measured in KiB */
+	NR_KERNEL_STACK_B,	/* measured in byte */
 #if IS_ENABLED(CONFIG_SHADOW_CALL_STACK)
 	NR_KERNEL_SCS_KB,	/* measured in KiB */
 #endif
diff --git a/kernel/fork.c b/kernel/fork.c
index 345f378e104d..2913d7c43dcb 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -382,11 +382,11 @@ static void account_kernel_stack(struct task_struct *tsk, int account)
 
 	/* All stack pages are in the same node. */
 	if (vm)
-		mod_lruvec_page_state(vm->pages[0], NR_KERNEL_STACK_KB,
-				      account * (THREAD_SIZE / 1024));
+		mod_lruvec_page_state(vm->pages[0], NR_KERNEL_STACK_B,
+				      account * THREAD_SIZE);
 	else
-		mod_lruvec_kmem_state(stack, NR_KERNEL_STACK_KB,
-				      account * (THREAD_SIZE / 1024));
+		mod_lruvec_kmem_state(stack, NR_KERNEL_STACK_B,
+				      account * THREAD_SIZE);
 }
 
 static int memcg_charge_kernel_stack(struct task_struct *tsk)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 695dedf8687a..a7ec79dcb7dc 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1500,7 +1500,7 @@ struct memory_stat {
 static struct memory_stat memory_stats[] = {
 	{ "anon", PAGE_SIZE, NR_ANON_MAPPED },
 	{ "file", PAGE_SIZE, NR_FILE_PAGES },
-	{ "kernel_stack", 1024, NR_KERNEL_STACK_KB },
+	{ "kernel_stack", 1, NR_KERNEL_STACK_B },
 	{ "percpu", 1, MEMCG_PERCPU_B },
 	{ "sock", PAGE_SIZE, MEMCG_SOCK },
 	{ "shmem", PAGE_SIZE, NR_SHMEM },
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 56e603eea1dd..c28f8e1f1ef6 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5573,7 +5573,7 @@ void show_free_areas(unsigned int filter, nodemask_t *nodemask)
 			K(node_page_state(pgdat, NR_ANON_THPS) * HPAGE_PMD_NR),
 #endif
 			K(node_page_state(pgdat, NR_WRITEBACK_TEMP)),
-			node_page_state(pgdat, NR_KERNEL_STACK_KB),
+			node_page_state(pgdat, NR_KERNEL_STACK_B) / 1024,
 #ifdef CONFIG_SHADOW_CALL_STACK
 			node_page_state(pgdat, NR_KERNEL_SCS_KB),
 #endif
diff --git a/mm/vmstat.c b/mm/vmstat.c
index f7857a7052e4..3e3bcaf7ba7e 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -353,7 +353,7 @@ void __mod_node_page_state(struct pglist_data *pgdat, enum node_stat_item item,
 	x = delta + __this_cpu_read(*p);
 
 	t = __this_cpu_read(pcp->stat_threshold);
-	if (unlikely(item == NR_KERNEL_STACK_KB))
+	if (unlikely(item == NR_KERNEL_STACK_B))
 		t <<= PAGE_SHIFT;
 
 	if (unlikely(abs(x) > t)) {
@@ -575,7 +575,7 @@ static inline void mod_node_state(struct pglist_data *pgdat,
 		 * for all cpus in a node.
 		 */
 		t = this_cpu_read(pcp->stat_threshold);
-		if (unlikely(item == NR_KERNEL_STACK_KB))
+		if (unlikely(item == NR_KERNEL_STACK_B))
 			t <<= PAGE_SHIFT;
 
 		o = this_cpu_read(*p);
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 4/9] mm: memcontrol: convert NR_ANON_THPS account to pages
@ 2020-12-05 13:02   ` Muchun Song
  0 siblings, 0 replies; 31+ messages in thread
From: Muchun Song @ 2020-12-05 13:02 UTC (permalink / raw)
  To: gregkh, rafael, adobriyan, akpm, hannes, mhocko, vdavydov.dev,
	hughd, will, guro, rppt, tglx, esyr, peterx, krisman, surenb,
	avagin, elver, rdunlap, iamjoonsoo.kim
  Cc: linux-kernel, linux-fsdevel, linux-mm, cgroups, Muchun Song

Convert the NR_ANON_THPS account to pages.

Signed-off-by: Muchun Song <songmuchun@bytedance.com>
---
 drivers/base/node.c |  3 +--
 fs/proc/meminfo.c   |  2 +-
 mm/huge_memory.c    |  3 ++-
 mm/memcontrol.c     | 20 ++++++--------------
 mm/page_alloc.c     |  2 +-
 mm/rmap.c           |  7 ++++---
 6 files changed, 15 insertions(+), 22 deletions(-)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index 855886a6ba0e..05c369e93e16 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -461,8 +461,7 @@ static ssize_t node_read_meminfo(struct device *dev,
 			     nid, K(sunreclaimable)
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 			     ,
-			     nid, K(node_page_state(pgdat, NR_ANON_THPS) *
-				    HPAGE_PMD_NR),
+			     nid, K(node_page_state(pgdat, NR_ANON_THPS)),
 			     nid, K(node_page_state(pgdat, NR_SHMEM_THPS) *
 				    HPAGE_PMD_NR),
 			     nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) *
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index c396b6cfba82..f447ac191d24 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -129,7 +129,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
 
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 	show_val_kb(m, "AnonHugePages:  ",
-		    global_node_page_state(NR_ANON_THPS) * HPAGE_PMD_NR);
+		    global_node_page_state(NR_ANON_THPS));
 	show_val_kb(m, "ShmemHugePages: ",
 		    global_node_page_state(NR_SHMEM_THPS) * HPAGE_PMD_NR);
 	show_val_kb(m, "ShmemPmdMapped: ",
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index c94dfc0cc1a3..1a13e1dab3ec 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2178,7 +2178,8 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,
 		lock_page_memcg(page);
 		if (atomic_add_negative(-1, compound_mapcount_ptr(page))) {
 			/* Last compound_mapcount is gone. */
-			__dec_lruvec_page_state(page, NR_ANON_THPS);
+			__mod_lruvec_page_state(page, NR_ANON_THPS,
+						-HPAGE_PMD_NR);
 			if (TestClearPageDoubleMap(page)) {
 				/* No need in mapcount reference anymore */
 				for (i = 0; i < HPAGE_PMD_NR; i++)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index a7ec79dcb7dc..39cb7f1b00d3 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1513,7 +1513,7 @@ static struct memory_stat memory_stats[] = {
 	 * on some architectures, the macro of HPAGE_PMD_SIZE is not
 	 * constant(e.g. powerpc).
 	 */
-	{ "anon_thp", 0, NR_ANON_THPS },
+	{ "anon_thp", PAGE_SIZE, NR_ANON_THPS },
 	{ "file_thp", 0, NR_FILE_THPS },
 	{ "shmem_thp", 0, NR_SHMEM_THPS },
 #endif
@@ -1546,8 +1546,7 @@ static int __init memory_stats_init(void)
 
 	for (i = 0; i < ARRAY_SIZE(memory_stats); i++) {
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
-		if (memory_stats[i].idx == NR_ANON_THPS ||
-		    memory_stats[i].idx == NR_FILE_THPS ||
+		if (memory_stats[i].idx == NR_FILE_THPS ||
 		    memory_stats[i].idx == NR_SHMEM_THPS)
 			memory_stats[i].ratio = HPAGE_PMD_SIZE;
 #endif
@@ -4069,10 +4068,6 @@ static int memcg_stat_show(struct seq_file *m, void *v)
 		if (memcg1_stats[i] == MEMCG_SWAP && !do_memsw_account())
 			continue;
 		nr = memcg_page_state_local(memcg, memcg1_stats[i]);
-#ifdef CONFIG_TRANSPARENT_HUGEPAGE
-		if (memcg1_stats[i] == NR_ANON_THPS)
-			nr *= HPAGE_PMD_NR;
-#endif
 		seq_printf(m, "%s %lu\n", memcg1_stat_names[i], nr * PAGE_SIZE);
 	}
 
@@ -4103,10 +4098,6 @@ static int memcg_stat_show(struct seq_file *m, void *v)
 		if (memcg1_stats[i] == MEMCG_SWAP && !do_memsw_account())
 			continue;
 		nr = memcg_page_state(memcg, memcg1_stats[i]);
-#ifdef CONFIG_TRANSPARENT_HUGEPAGE
-		if (memcg1_stats[i] == NR_ANON_THPS)
-			nr *= HPAGE_PMD_NR;
-#endif
 		seq_printf(m, "total_%s %llu\n", memcg1_stat_names[i],
 						(u64)nr * PAGE_SIZE);
 	}
@@ -5634,10 +5625,11 @@ static int mem_cgroup_move_account(struct page *page,
 			__mod_lruvec_state(from_vec, NR_ANON_MAPPED, -nr_pages);
 			__mod_lruvec_state(to_vec, NR_ANON_MAPPED, nr_pages);
 			if (PageTransHuge(page)) {
-				__dec_lruvec_state(from_vec, NR_ANON_THPS);
-				__inc_lruvec_state(to_vec, NR_ANON_THPS);
+				__mod_lruvec_state(from_vec, NR_ANON_THPS,
+						   -nr_pages);
+				__mod_lruvec_state(to_vec, NR_ANON_THPS,
+						   nr_pages);
 			}
-
 		}
 	} else {
 		__mod_lruvec_state(from_vec, NR_FILE_PAGES, -nr_pages);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index c28f8e1f1ef6..fabdbb340806 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5570,7 +5570,7 @@ void show_free_areas(unsigned int filter, nodemask_t *nodemask)
 			K(node_page_state(pgdat, NR_SHMEM_THPS) * HPAGE_PMD_NR),
 			K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED)
 					* HPAGE_PMD_NR),
-			K(node_page_state(pgdat, NR_ANON_THPS) * HPAGE_PMD_NR),
+			K(node_page_state(pgdat, NR_ANON_THPS)),
 #endif
 			K(node_page_state(pgdat, NR_WRITEBACK_TEMP)),
 			node_page_state(pgdat, NR_KERNEL_STACK_B) / 1024,
diff --git a/mm/rmap.c b/mm/rmap.c
index 08c56aaf72eb..f59e92e26b61 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1144,7 +1144,8 @@ void do_page_add_anon_rmap(struct page *page,
 		 * disabled.
 		 */
 		if (compound)
-			__inc_lruvec_page_state(page, NR_ANON_THPS);
+			__mod_lruvec_page_state(page, NR_ANON_THPS,
+						HPAGE_PMD_NR);
 		__mod_lruvec_page_state(page, NR_ANON_MAPPED, nr);
 	}
 
@@ -1186,7 +1187,7 @@ void page_add_new_anon_rmap(struct page *page,
 		if (hpage_pincount_available(page))
 			atomic_set(compound_pincount_ptr(page), 0);
 
-		__inc_lruvec_page_state(page, NR_ANON_THPS);
+		__mod_lruvec_page_state(page, NR_ANON_THPS, HPAGE_PMD_NR);
 	} else {
 		/* Anon THP always mapped first with PMD */
 		VM_BUG_ON_PAGE(PageTransCompound(page), page);
@@ -1292,7 +1293,7 @@ static void page_remove_anon_compound_rmap(struct page *page)
 	if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE))
 		return;
 
-	__dec_lruvec_page_state(page, NR_ANON_THPS);
+	__mod_lruvec_page_state(page, NR_ANON_THPS, -HPAGE_PMD_NR);
 
 	if (TestClearPageDoubleMap(page)) {
 		/*
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 4/9] mm: memcontrol: convert NR_ANON_THPS account to pages
@ 2020-12-05 13:02   ` Muchun Song
  0 siblings, 0 replies; 31+ messages in thread
From: Muchun Song @ 2020-12-05 13:02 UTC (permalink / raw)
  To: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	rafael-DgEjT+Ai2ygdnm+yROfE0A, adobriyan-Re5JQEeQqe8AvxtiuMwx3w,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
	hannes-druUgvl0LCNAfugRpC6u6w, mhocko-DgEjT+Ai2ygdnm+yROfE0A,
	vdavydov.dev-Re5JQEeQqe8AvxtiuMwx3w,
	hughd-hpIqsD4AKlfQT0dZR+AlfA, will-DgEjT+Ai2ygdnm+yROfE0A,
	guro-b10kYP2dOMg, rppt-DgEjT+Ai2ygdnm+yROfE0A,
	tglx-hfZtesqFncYOwBW4kG4KsQ, esyr-H+wXaHxf7aLQT0dZR+AlfA,
	peterx-H+wXaHxf7aLQT0dZR+AlfA, krisman-ZGY8ohtN/8qB+jHODAdFcQ,
	surenb-hpIqsD4AKlfQT0dZR+AlfA, avagin-GEFAQzZX7r8dnm+yROfE0A,
	elver-hpIqsD4AKlfQT0dZR+AlfA, rdunlap-wEGCiKHe2LqWVfeAwA7xHQ,
	iamjoonsoo.kim-Hm3cg6mZ9cc
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA,
	linux-mm-Bw31MaZKKs3YtjvyW6yDsg, cgroups-u79uwXL29TY76Z2rM5mHXA,
	Muchun Song

Convert the NR_ANON_THPS account to pages.

Signed-off-by: Muchun Song <songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>
---
 drivers/base/node.c |  3 +--
 fs/proc/meminfo.c   |  2 +-
 mm/huge_memory.c    |  3 ++-
 mm/memcontrol.c     | 20 ++++++--------------
 mm/page_alloc.c     |  2 +-
 mm/rmap.c           |  7 ++++---
 6 files changed, 15 insertions(+), 22 deletions(-)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index 855886a6ba0e..05c369e93e16 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -461,8 +461,7 @@ static ssize_t node_read_meminfo(struct device *dev,
 			     nid, K(sunreclaimable)
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 			     ,
-			     nid, K(node_page_state(pgdat, NR_ANON_THPS) *
-				    HPAGE_PMD_NR),
+			     nid, K(node_page_state(pgdat, NR_ANON_THPS)),
 			     nid, K(node_page_state(pgdat, NR_SHMEM_THPS) *
 				    HPAGE_PMD_NR),
 			     nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) *
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index c396b6cfba82..f447ac191d24 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -129,7 +129,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
 
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 	show_val_kb(m, "AnonHugePages:  ",
-		    global_node_page_state(NR_ANON_THPS) * HPAGE_PMD_NR);
+		    global_node_page_state(NR_ANON_THPS));
 	show_val_kb(m, "ShmemHugePages: ",
 		    global_node_page_state(NR_SHMEM_THPS) * HPAGE_PMD_NR);
 	show_val_kb(m, "ShmemPmdMapped: ",
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index c94dfc0cc1a3..1a13e1dab3ec 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2178,7 +2178,8 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,
 		lock_page_memcg(page);
 		if (atomic_add_negative(-1, compound_mapcount_ptr(page))) {
 			/* Last compound_mapcount is gone. */
-			__dec_lruvec_page_state(page, NR_ANON_THPS);
+			__mod_lruvec_page_state(page, NR_ANON_THPS,
+						-HPAGE_PMD_NR);
 			if (TestClearPageDoubleMap(page)) {
 				/* No need in mapcount reference anymore */
 				for (i = 0; i < HPAGE_PMD_NR; i++)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index a7ec79dcb7dc..39cb7f1b00d3 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1513,7 +1513,7 @@ static struct memory_stat memory_stats[] = {
 	 * on some architectures, the macro of HPAGE_PMD_SIZE is not
 	 * constant(e.g. powerpc).
 	 */
-	{ "anon_thp", 0, NR_ANON_THPS },
+	{ "anon_thp", PAGE_SIZE, NR_ANON_THPS },
 	{ "file_thp", 0, NR_FILE_THPS },
 	{ "shmem_thp", 0, NR_SHMEM_THPS },
 #endif
@@ -1546,8 +1546,7 @@ static int __init memory_stats_init(void)
 
 	for (i = 0; i < ARRAY_SIZE(memory_stats); i++) {
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
-		if (memory_stats[i].idx == NR_ANON_THPS ||
-		    memory_stats[i].idx == NR_FILE_THPS ||
+		if (memory_stats[i].idx == NR_FILE_THPS ||
 		    memory_stats[i].idx == NR_SHMEM_THPS)
 			memory_stats[i].ratio = HPAGE_PMD_SIZE;
 #endif
@@ -4069,10 +4068,6 @@ static int memcg_stat_show(struct seq_file *m, void *v)
 		if (memcg1_stats[i] == MEMCG_SWAP && !do_memsw_account())
 			continue;
 		nr = memcg_page_state_local(memcg, memcg1_stats[i]);
-#ifdef CONFIG_TRANSPARENT_HUGEPAGE
-		if (memcg1_stats[i] == NR_ANON_THPS)
-			nr *= HPAGE_PMD_NR;
-#endif
 		seq_printf(m, "%s %lu\n", memcg1_stat_names[i], nr * PAGE_SIZE);
 	}
 
@@ -4103,10 +4098,6 @@ static int memcg_stat_show(struct seq_file *m, void *v)
 		if (memcg1_stats[i] == MEMCG_SWAP && !do_memsw_account())
 			continue;
 		nr = memcg_page_state(memcg, memcg1_stats[i]);
-#ifdef CONFIG_TRANSPARENT_HUGEPAGE
-		if (memcg1_stats[i] == NR_ANON_THPS)
-			nr *= HPAGE_PMD_NR;
-#endif
 		seq_printf(m, "total_%s %llu\n", memcg1_stat_names[i],
 						(u64)nr * PAGE_SIZE);
 	}
@@ -5634,10 +5625,11 @@ static int mem_cgroup_move_account(struct page *page,
 			__mod_lruvec_state(from_vec, NR_ANON_MAPPED, -nr_pages);
 			__mod_lruvec_state(to_vec, NR_ANON_MAPPED, nr_pages);
 			if (PageTransHuge(page)) {
-				__dec_lruvec_state(from_vec, NR_ANON_THPS);
-				__inc_lruvec_state(to_vec, NR_ANON_THPS);
+				__mod_lruvec_state(from_vec, NR_ANON_THPS,
+						   -nr_pages);
+				__mod_lruvec_state(to_vec, NR_ANON_THPS,
+						   nr_pages);
 			}
-
 		}
 	} else {
 		__mod_lruvec_state(from_vec, NR_FILE_PAGES, -nr_pages);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index c28f8e1f1ef6..fabdbb340806 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5570,7 +5570,7 @@ void show_free_areas(unsigned int filter, nodemask_t *nodemask)
 			K(node_page_state(pgdat, NR_SHMEM_THPS) * HPAGE_PMD_NR),
 			K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED)
 					* HPAGE_PMD_NR),
-			K(node_page_state(pgdat, NR_ANON_THPS) * HPAGE_PMD_NR),
+			K(node_page_state(pgdat, NR_ANON_THPS)),
 #endif
 			K(node_page_state(pgdat, NR_WRITEBACK_TEMP)),
 			node_page_state(pgdat, NR_KERNEL_STACK_B) / 1024,
diff --git a/mm/rmap.c b/mm/rmap.c
index 08c56aaf72eb..f59e92e26b61 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1144,7 +1144,8 @@ void do_page_add_anon_rmap(struct page *page,
 		 * disabled.
 		 */
 		if (compound)
-			__inc_lruvec_page_state(page, NR_ANON_THPS);
+			__mod_lruvec_page_state(page, NR_ANON_THPS,
+						HPAGE_PMD_NR);
 		__mod_lruvec_page_state(page, NR_ANON_MAPPED, nr);
 	}
 
@@ -1186,7 +1187,7 @@ void page_add_new_anon_rmap(struct page *page,
 		if (hpage_pincount_available(page))
 			atomic_set(compound_pincount_ptr(page), 0);
 
-		__inc_lruvec_page_state(page, NR_ANON_THPS);
+		__mod_lruvec_page_state(page, NR_ANON_THPS, HPAGE_PMD_NR);
 	} else {
 		/* Anon THP always mapped first with PMD */
 		VM_BUG_ON_PAGE(PageTransCompound(page), page);
@@ -1292,7 +1293,7 @@ static void page_remove_anon_compound_rmap(struct page *page)
 	if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE))
 		return;
 
-	__dec_lruvec_page_state(page, NR_ANON_THPS);
+	__mod_lruvec_page_state(page, NR_ANON_THPS, -HPAGE_PMD_NR);
 
 	if (TestClearPageDoubleMap(page)) {
 		/*
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 5/9] mm: memcontrol: convert NR_FILE_THPS account to pages
  2020-12-05 13:02 [PATCH 0/9] Convert all THP vmstat counters to pages Muchun Song
                   ` (3 preceding siblings ...)
  2020-12-05 13:02   ` Muchun Song
@ 2020-12-05 13:02 ` Muchun Song
  2020-12-05 14:10     ` Greg KH
  2020-12-05 13:02 ` [PATCH 6/9] mm: memcontrol: convert NR_SHMEM_THPS " Muchun Song
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 31+ messages in thread
From: Muchun Song @ 2020-12-05 13:02 UTC (permalink / raw)
  To: gregkh, rafael, adobriyan, akpm, hannes, mhocko, vdavydov.dev,
	hughd, will, guro, rppt, tglx, esyr, peterx, krisman, surenb,
	avagin, elver, rdunlap, iamjoonsoo.kim
  Cc: linux-kernel, linux-fsdevel, linux-mm, cgroups, Muchun Song

Converrt NR_FILE_THPS account to pages.

Signed-off-by: Muchun Song <songmuchun@bytedance.com>
---
 drivers/base/node.c | 3 +--
 fs/proc/meminfo.c   | 2 +-
 mm/filemap.c        | 2 +-
 mm/huge_memory.c    | 3 ++-
 mm/khugepaged.c     | 2 +-
 mm/memcontrol.c     | 5 ++---
 6 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index 05c369e93e16..f6a9521bbcf8 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -466,8 +466,7 @@ static ssize_t node_read_meminfo(struct device *dev,
 				    HPAGE_PMD_NR),
 			     nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) *
 				    HPAGE_PMD_NR),
-			     nid, K(node_page_state(pgdat, NR_FILE_THPS) *
-				    HPAGE_PMD_NR),
+			     nid, K(node_page_state(pgdat, NR_FILE_THPS)),
 			     nid, K(node_page_state(pgdat, NR_FILE_PMDMAPPED) *
 				    HPAGE_PMD_NR)
 #endif
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index f447ac191d24..9b2cb770326e 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -135,7 +135,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
 	show_val_kb(m, "ShmemPmdMapped: ",
 		    global_node_page_state(NR_SHMEM_PMDMAPPED) * HPAGE_PMD_NR);
 	show_val_kb(m, "FileHugePages:  ",
-		    global_node_page_state(NR_FILE_THPS) * HPAGE_PMD_NR);
+		    global_node_page_state(NR_FILE_THPS));
 	show_val_kb(m, "FilePmdMapped:  ",
 		    global_node_page_state(NR_FILE_PMDMAPPED) * HPAGE_PMD_NR);
 #endif
diff --git a/mm/filemap.c b/mm/filemap.c
index 28e7309c29c8..c4dcb1144883 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -206,7 +206,7 @@ static void unaccount_page_cache_page(struct address_space *mapping,
 		if (PageTransHuge(page))
 			__dec_lruvec_page_state(page, NR_SHMEM_THPS);
 	} else if (PageTransHuge(page)) {
-		__dec_lruvec_page_state(page, NR_FILE_THPS);
+		__mod_lruvec_page_state(page, NR_FILE_THPS, -HPAGE_PMD_NR);
 		filemap_nr_thps_dec(mapping);
 	}
 
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 1a13e1dab3ec..37840bdeaad0 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2748,7 +2748,8 @@ int split_huge_page_to_list(struct page *page, struct list_head *list)
 			if (PageSwapBacked(head))
 				__dec_lruvec_page_state(head, NR_SHMEM_THPS);
 			else
-				__dec_lruvec_page_state(head, NR_FILE_THPS);
+				__mod_lruvec_page_state(head, NR_FILE_THPS,
+							-HPAGE_PMD_NR);
 		}
 
 		__split_huge_page(page, list, end);
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index ad316d2e1fee..1e1ced2208d0 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -1859,7 +1859,7 @@ static void collapse_file(struct mm_struct *mm,
 	if (is_shmem)
 		__inc_lruvec_page_state(new_page, NR_SHMEM_THPS);
 	else {
-		__inc_lruvec_page_state(new_page, NR_FILE_THPS);
+		__mod_lruvec_page_state(new_page, NR_FILE_THPS, HPAGE_PMD_NR);
 		filemap_nr_thps_inc(mapping);
 	}
 
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 39cb7f1b00d3..dce76dddac61 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1514,7 +1514,7 @@ static struct memory_stat memory_stats[] = {
 	 * constant(e.g. powerpc).
 	 */
 	{ "anon_thp", PAGE_SIZE, NR_ANON_THPS },
-	{ "file_thp", 0, NR_FILE_THPS },
+	{ "file_thp", PAGE_SIZE, NR_FILE_THPS },
 	{ "shmem_thp", 0, NR_SHMEM_THPS },
 #endif
 	{ "inactive_anon", PAGE_SIZE, NR_INACTIVE_ANON },
@@ -1546,8 +1546,7 @@ static int __init memory_stats_init(void)
 
 	for (i = 0; i < ARRAY_SIZE(memory_stats); i++) {
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
-		if (memory_stats[i].idx == NR_FILE_THPS ||
-		    memory_stats[i].idx == NR_SHMEM_THPS)
+		if (memory_stats[i].idx == NR_SHMEM_THPS)
 			memory_stats[i].ratio = HPAGE_PMD_SIZE;
 #endif
 		VM_BUG_ON(!memory_stats[i].ratio);
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 6/9] mm: memcontrol: convert NR_SHMEM_THPS account to pages
  2020-12-05 13:02 [PATCH 0/9] Convert all THP vmstat counters to pages Muchun Song
                   ` (4 preceding siblings ...)
  2020-12-05 13:02 ` [PATCH 5/9] mm: memcontrol: convert NR_FILE_THPS " Muchun Song
@ 2020-12-05 13:02 ` Muchun Song
  2020-12-05 13:02   ` Muchun Song
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 31+ messages in thread
From: Muchun Song @ 2020-12-05 13:02 UTC (permalink / raw)
  To: gregkh, rafael, adobriyan, akpm, hannes, mhocko, vdavydov.dev,
	hughd, will, guro, rppt, tglx, esyr, peterx, krisman, surenb,
	avagin, elver, rdunlap, iamjoonsoo.kim
  Cc: linux-kernel, linux-fsdevel, linux-mm, cgroups, Muchun Song

Convert NR_SHMEM_THPS account to pages

Signed-off-by: Muchun Song <songmuchun@bytedance.com>
---
 drivers/base/node.c |  3 +--
 fs/proc/meminfo.c   |  2 +-
 mm/filemap.c        |  2 +-
 mm/huge_memory.c    |  3 ++-
 mm/khugepaged.c     |  2 +-
 mm/memcontrol.c     | 26 ++------------------------
 mm/page_alloc.c     |  2 +-
 mm/shmem.c          |  3 ++-
 8 files changed, 11 insertions(+), 32 deletions(-)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index f6a9521bbcf8..a64f9c5484a0 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -462,8 +462,7 @@ static ssize_t node_read_meminfo(struct device *dev,
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 			     ,
 			     nid, K(node_page_state(pgdat, NR_ANON_THPS)),
-			     nid, K(node_page_state(pgdat, NR_SHMEM_THPS) *
-				    HPAGE_PMD_NR),
+			     nid, K(node_page_state(pgdat, NR_SHMEM_THPS)),
 			     nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) *
 				    HPAGE_PMD_NR),
 			     nid, K(node_page_state(pgdat, NR_FILE_THPS)),
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index 9b2cb770326e..574779b6e48c 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -131,7 +131,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
 	show_val_kb(m, "AnonHugePages:  ",
 		    global_node_page_state(NR_ANON_THPS));
 	show_val_kb(m, "ShmemHugePages: ",
-		    global_node_page_state(NR_SHMEM_THPS) * HPAGE_PMD_NR);
+		    global_node_page_state(NR_SHMEM_THPS));
 	show_val_kb(m, "ShmemPmdMapped: ",
 		    global_node_page_state(NR_SHMEM_PMDMAPPED) * HPAGE_PMD_NR);
 	show_val_kb(m, "FileHugePages:  ",
diff --git a/mm/filemap.c b/mm/filemap.c
index c4dcb1144883..5fdefbbc1bc2 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -204,7 +204,7 @@ static void unaccount_page_cache_page(struct address_space *mapping,
 	if (PageSwapBacked(page)) {
 		__mod_lruvec_page_state(page, NR_SHMEM, -nr);
 		if (PageTransHuge(page))
-			__dec_lruvec_page_state(page, NR_SHMEM_THPS);
+			__mod_lruvec_page_state(page, NR_SHMEM_THPS, -HPAGE_PMD_NR);
 	} else if (PageTransHuge(page)) {
 		__mod_lruvec_page_state(page, NR_FILE_THPS, -HPAGE_PMD_NR);
 		filemap_nr_thps_dec(mapping);
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 37840bdeaad0..0e8541bd9f50 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2746,7 +2746,8 @@ int split_huge_page_to_list(struct page *page, struct list_head *list)
 		spin_unlock(&ds_queue->split_queue_lock);
 		if (mapping) {
 			if (PageSwapBacked(head))
-				__dec_lruvec_page_state(head, NR_SHMEM_THPS);
+				__mod_lruvec_page_state(head, NR_SHMEM_THPS,
+							-HPAGE_PMD_NR);
 			else
 				__mod_lruvec_page_state(head, NR_FILE_THPS,
 							-HPAGE_PMD_NR);
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 1e1ced2208d0..4fe79ccfc312 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -1857,7 +1857,7 @@ static void collapse_file(struct mm_struct *mm,
 	}
 
 	if (is_shmem)
-		__inc_lruvec_page_state(new_page, NR_SHMEM_THPS);
+		__mod_lruvec_page_state(new_page, NR_SHMEM_THPS, HPAGE_PMD_NR);
 	else {
 		__mod_lruvec_page_state(new_page, NR_FILE_THPS, HPAGE_PMD_NR);
 		filemap_nr_thps_inc(mapping);
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index dce76dddac61..48d70c1ad301 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1497,7 +1497,7 @@ struct memory_stat {
 	unsigned int idx;
 };
 
-static struct memory_stat memory_stats[] = {
+static const struct memory_stat memory_stats[] = {
 	{ "anon", PAGE_SIZE, NR_ANON_MAPPED },
 	{ "file", PAGE_SIZE, NR_FILE_PAGES },
 	{ "kernel_stack", 1, NR_KERNEL_STACK_B },
@@ -1508,14 +1508,9 @@ static struct memory_stat memory_stats[] = {
 	{ "file_dirty", PAGE_SIZE, NR_FILE_DIRTY },
 	{ "file_writeback", PAGE_SIZE, NR_WRITEBACK },
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
-	/*
-	 * The ratio will be initialized in memory_stats_init(). Because
-	 * on some architectures, the macro of HPAGE_PMD_SIZE is not
-	 * constant(e.g. powerpc).
-	 */
 	{ "anon_thp", PAGE_SIZE, NR_ANON_THPS },
 	{ "file_thp", PAGE_SIZE, NR_FILE_THPS },
-	{ "shmem_thp", 0, NR_SHMEM_THPS },
+	{ "shmem_thp", PAGE_SIZE, NR_SHMEM_THPS },
 #endif
 	{ "inactive_anon", PAGE_SIZE, NR_INACTIVE_ANON },
 	{ "active_anon", PAGE_SIZE, NR_ACTIVE_ANON },
@@ -1540,23 +1535,6 @@ static struct memory_stat memory_stats[] = {
 	{ "workingset_nodereclaim", 1, WORKINGSET_NODERECLAIM },
 };
 
-static int __init memory_stats_init(void)
-{
-	int i;
-
-	for (i = 0; i < ARRAY_SIZE(memory_stats); i++) {
-#ifdef CONFIG_TRANSPARENT_HUGEPAGE
-		if (memory_stats[i].idx == NR_SHMEM_THPS)
-			memory_stats[i].ratio = HPAGE_PMD_SIZE;
-#endif
-		VM_BUG_ON(!memory_stats[i].ratio);
-		VM_BUG_ON(memory_stats[i].idx >= MEMCG_NR_STAT);
-	}
-
-	return 0;
-}
-pure_initcall(memory_stats_init);
-
 static char *memory_stat_format(struct mem_cgroup *memcg)
 {
 	struct seq_buf s;
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index fabdbb340806..8fb9f3d38b67 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5567,7 +5567,7 @@ void show_free_areas(unsigned int filter, nodemask_t *nodemask)
 			K(node_page_state(pgdat, NR_WRITEBACK)),
 			K(node_page_state(pgdat, NR_SHMEM)),
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
-			K(node_page_state(pgdat, NR_SHMEM_THPS) * HPAGE_PMD_NR),
+			K(node_page_state(pgdat, NR_SHMEM_THPS)),
 			K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED)
 					* HPAGE_PMD_NR),
 			K(node_page_state(pgdat, NR_ANON_THPS)),
diff --git a/mm/shmem.c b/mm/shmem.c
index 5da4f1a3e663..ea5d8c9ccb5b 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -713,7 +713,8 @@ static int shmem_add_to_page_cache(struct page *page,
 		}
 		if (PageTransHuge(page)) {
 			count_vm_event(THP_FILE_ALLOC);
-			__inc_lruvec_page_state(page, NR_SHMEM_THPS);
+			__mod_lruvec_page_state(page, NR_SHMEM_THPS,
+						HPAGE_PMD_NR);
 		}
 		mapping->nrpages += nr;
 		__mod_lruvec_page_state(page, NR_FILE_PAGES, nr);
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 7/9] mm: memcontrol: convert NR_SHMEM_PMDMAPPED account to pages
@ 2020-12-05 13:02   ` Muchun Song
  0 siblings, 0 replies; 31+ messages in thread
From: Muchun Song @ 2020-12-05 13:02 UTC (permalink / raw)
  To: gregkh, rafael, adobriyan, akpm, hannes, mhocko, vdavydov.dev,
	hughd, will, guro, rppt, tglx, esyr, peterx, krisman, surenb,
	avagin, elver, rdunlap, iamjoonsoo.kim
  Cc: linux-kernel, linux-fsdevel, linux-mm, cgroups, Muchun Song

Convert NR_SHMEM_PMDMAPPED account to pages.

Signed-off-by: Muchun Song <songmuchun@bytedance.com>
---
 drivers/base/node.c | 3 +--
 fs/proc/meminfo.c   | 2 +-
 mm/page_alloc.c     | 3 +--
 mm/rmap.c           | 6 ++++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index a64f9c5484a0..fe90888f90a8 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -463,8 +463,7 @@ static ssize_t node_read_meminfo(struct device *dev,
 			     ,
 			     nid, K(node_page_state(pgdat, NR_ANON_THPS)),
 			     nid, K(node_page_state(pgdat, NR_SHMEM_THPS)),
-			     nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) *
-				    HPAGE_PMD_NR),
+			     nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED)),
 			     nid, K(node_page_state(pgdat, NR_FILE_THPS)),
 			     nid, K(node_page_state(pgdat, NR_FILE_PMDMAPPED) *
 				    HPAGE_PMD_NR)
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index 574779b6e48c..b2bff8359497 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -133,7 +133,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
 	show_val_kb(m, "ShmemHugePages: ",
 		    global_node_page_state(NR_SHMEM_THPS));
 	show_val_kb(m, "ShmemPmdMapped: ",
-		    global_node_page_state(NR_SHMEM_PMDMAPPED) * HPAGE_PMD_NR);
+		    global_node_page_state(NR_SHMEM_PMDMAPPED));
 	show_val_kb(m, "FileHugePages:  ",
 		    global_node_page_state(NR_FILE_THPS));
 	show_val_kb(m, "FilePmdMapped:  ",
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 8fb9f3d38b67..ddaa1dcd6e38 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5568,8 +5568,7 @@ void show_free_areas(unsigned int filter, nodemask_t *nodemask)
 			K(node_page_state(pgdat, NR_SHMEM)),
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 			K(node_page_state(pgdat, NR_SHMEM_THPS)),
-			K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED)
-					* HPAGE_PMD_NR),
+			K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED)),
 			K(node_page_state(pgdat, NR_ANON_THPS)),
 #endif
 			K(node_page_state(pgdat, NR_WRITEBACK_TEMP)),
diff --git a/mm/rmap.c b/mm/rmap.c
index f59e92e26b61..3089ad6bf468 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1219,7 +1219,8 @@ void page_add_file_rmap(struct page *page, bool compound)
 		if (!atomic_inc_and_test(compound_mapcount_ptr(page)))
 			goto out;
 		if (PageSwapBacked(page))
-			__inc_node_page_state(page, NR_SHMEM_PMDMAPPED);
+			__mod_lruvec_page_state(page, NR_SHMEM_PMDMAPPED,
+						HPAGE_PMD_NR);
 		else
 			__inc_node_page_state(page, NR_FILE_PMDMAPPED);
 	} else {
@@ -1260,7 +1261,8 @@ static void page_remove_file_rmap(struct page *page, bool compound)
 		if (!atomic_add_negative(-1, compound_mapcount_ptr(page)))
 			return;
 		if (PageSwapBacked(page))
-			__dec_node_page_state(page, NR_SHMEM_PMDMAPPED);
+			__mod_lruvec_page_state(page, NR_SHMEM_PMDMAPPED,
+						-HPAGE_PMD_NR);
 		else
 			__dec_node_page_state(page, NR_FILE_PMDMAPPED);
 	} else {
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 7/9] mm: memcontrol: convert NR_SHMEM_PMDMAPPED account to pages
@ 2020-12-05 13:02   ` Muchun Song
  0 siblings, 0 replies; 31+ messages in thread
From: Muchun Song @ 2020-12-05 13:02 UTC (permalink / raw)
  To: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	rafael-DgEjT+Ai2ygdnm+yROfE0A, adobriyan-Re5JQEeQqe8AvxtiuMwx3w,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
	hannes-druUgvl0LCNAfugRpC6u6w, mhocko-DgEjT+Ai2ygdnm+yROfE0A,
	vdavydov.dev-Re5JQEeQqe8AvxtiuMwx3w,
	hughd-hpIqsD4AKlfQT0dZR+AlfA, will-DgEjT+Ai2ygdnm+yROfE0A,
	guro-b10kYP2dOMg, rppt-DgEjT+Ai2ygdnm+yROfE0A,
	tglx-hfZtesqFncYOwBW4kG4KsQ, esyr-H+wXaHxf7aLQT0dZR+AlfA,
	peterx-H+wXaHxf7aLQT0dZR+AlfA, krisman-ZGY8ohtN/8qB+jHODAdFcQ,
	surenb-hpIqsD4AKlfQT0dZR+AlfA, avagin-GEFAQzZX7r8dnm+yROfE0A,
	elver-hpIqsD4AKlfQT0dZR+AlfA, rdunlap-wEGCiKHe2LqWVfeAwA7xHQ,
	iamjoonsoo.kim-Hm3cg6mZ9cc
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA,
	linux-mm-Bw31MaZKKs3YtjvyW6yDsg, cgroups-u79uwXL29TY76Z2rM5mHXA,
	Muchun Song

Convert NR_SHMEM_PMDMAPPED account to pages.

Signed-off-by: Muchun Song <songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>
---
 drivers/base/node.c | 3 +--
 fs/proc/meminfo.c   | 2 +-
 mm/page_alloc.c     | 3 +--
 mm/rmap.c           | 6 ++++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index a64f9c5484a0..fe90888f90a8 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -463,8 +463,7 @@ static ssize_t node_read_meminfo(struct device *dev,
 			     ,
 			     nid, K(node_page_state(pgdat, NR_ANON_THPS)),
 			     nid, K(node_page_state(pgdat, NR_SHMEM_THPS)),
-			     nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) *
-				    HPAGE_PMD_NR),
+			     nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED)),
 			     nid, K(node_page_state(pgdat, NR_FILE_THPS)),
 			     nid, K(node_page_state(pgdat, NR_FILE_PMDMAPPED) *
 				    HPAGE_PMD_NR)
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index 574779b6e48c..b2bff8359497 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -133,7 +133,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
 	show_val_kb(m, "ShmemHugePages: ",
 		    global_node_page_state(NR_SHMEM_THPS));
 	show_val_kb(m, "ShmemPmdMapped: ",
-		    global_node_page_state(NR_SHMEM_PMDMAPPED) * HPAGE_PMD_NR);
+		    global_node_page_state(NR_SHMEM_PMDMAPPED));
 	show_val_kb(m, "FileHugePages:  ",
 		    global_node_page_state(NR_FILE_THPS));
 	show_val_kb(m, "FilePmdMapped:  ",
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 8fb9f3d38b67..ddaa1dcd6e38 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5568,8 +5568,7 @@ void show_free_areas(unsigned int filter, nodemask_t *nodemask)
 			K(node_page_state(pgdat, NR_SHMEM)),
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 			K(node_page_state(pgdat, NR_SHMEM_THPS)),
-			K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED)
-					* HPAGE_PMD_NR),
+			K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED)),
 			K(node_page_state(pgdat, NR_ANON_THPS)),
 #endif
 			K(node_page_state(pgdat, NR_WRITEBACK_TEMP)),
diff --git a/mm/rmap.c b/mm/rmap.c
index f59e92e26b61..3089ad6bf468 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1219,7 +1219,8 @@ void page_add_file_rmap(struct page *page, bool compound)
 		if (!atomic_inc_and_test(compound_mapcount_ptr(page)))
 			goto out;
 		if (PageSwapBacked(page))
-			__inc_node_page_state(page, NR_SHMEM_PMDMAPPED);
+			__mod_lruvec_page_state(page, NR_SHMEM_PMDMAPPED,
+						HPAGE_PMD_NR);
 		else
 			__inc_node_page_state(page, NR_FILE_PMDMAPPED);
 	} else {
@@ -1260,7 +1261,8 @@ static void page_remove_file_rmap(struct page *page, bool compound)
 		if (!atomic_add_negative(-1, compound_mapcount_ptr(page)))
 			return;
 		if (PageSwapBacked(page))
-			__dec_node_page_state(page, NR_SHMEM_PMDMAPPED);
+			__mod_lruvec_page_state(page, NR_SHMEM_PMDMAPPED,
+						-HPAGE_PMD_NR);
 		else
 			__dec_node_page_state(page, NR_FILE_PMDMAPPED);
 	} else {
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 8/9] mm: memcontrol: convert NR_FILE_PMDMAPPED account to pages
@ 2020-12-05 13:02   ` Muchun Song
  0 siblings, 0 replies; 31+ messages in thread
From: Muchun Song @ 2020-12-05 13:02 UTC (permalink / raw)
  To: gregkh, rafael, adobriyan, akpm, hannes, mhocko, vdavydov.dev,
	hughd, will, guro, rppt, tglx, esyr, peterx, krisman, surenb,
	avagin, elver, rdunlap, iamjoonsoo.kim
  Cc: linux-kernel, linux-fsdevel, linux-mm, cgroups, Muchun Song

Convert NR_FILE_PMDMAPPED account to pages

Signed-off-by: Muchun Song <songmuchun@bytedance.com>
---
 drivers/base/node.c | 3 +--
 fs/proc/meminfo.c   | 2 +-
 mm/rmap.c           | 6 ++++--
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index fe90888f90a8..679215cdeb87 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -465,8 +465,7 @@ static ssize_t node_read_meminfo(struct device *dev,
 			     nid, K(node_page_state(pgdat, NR_SHMEM_THPS)),
 			     nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED)),
 			     nid, K(node_page_state(pgdat, NR_FILE_THPS)),
-			     nid, K(node_page_state(pgdat, NR_FILE_PMDMAPPED) *
-				    HPAGE_PMD_NR)
+			     nid, K(node_page_state(pgdat, NR_FILE_PMDMAPPED))
 #endif
 			    );
 	len += hugetlb_report_node_meminfo(buf, len, nid);
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index b2bff8359497..a0828df01721 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -137,7 +137,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
 	show_val_kb(m, "FileHugePages:  ",
 		    global_node_page_state(NR_FILE_THPS));
 	show_val_kb(m, "FilePmdMapped:  ",
-		    global_node_page_state(NR_FILE_PMDMAPPED) * HPAGE_PMD_NR);
+		    global_node_page_state(NR_FILE_PMDMAPPED));
 #endif
 
 #ifdef CONFIG_CMA
diff --git a/mm/rmap.c b/mm/rmap.c
index 3089ad6bf468..e383c5619501 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1222,7 +1222,8 @@ void page_add_file_rmap(struct page *page, bool compound)
 			__mod_lruvec_page_state(page, NR_SHMEM_PMDMAPPED,
 						HPAGE_PMD_NR);
 		else
-			__inc_node_page_state(page, NR_FILE_PMDMAPPED);
+			__mod_lruvec_page_state(page, NR_FILE_PMDMAPPED,
+						HPAGE_PMD_NR);
 	} else {
 		if (PageTransCompound(page) && page_mapping(page)) {
 			VM_WARN_ON_ONCE(!PageLocked(page));
@@ -1264,7 +1265,8 @@ static void page_remove_file_rmap(struct page *page, bool compound)
 			__mod_lruvec_page_state(page, NR_SHMEM_PMDMAPPED,
 						-HPAGE_PMD_NR);
 		else
-			__dec_node_page_state(page, NR_FILE_PMDMAPPED);
+			__mod_lruvec_page_state(page, NR_FILE_PMDMAPPED,
+						-HPAGE_PMD_NR);
 	} else {
 		if (!atomic_add_negative(-1, &page->_mapcount))
 			return;
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 8/9] mm: memcontrol: convert NR_FILE_PMDMAPPED account to pages
@ 2020-12-05 13:02   ` Muchun Song
  0 siblings, 0 replies; 31+ messages in thread
From: Muchun Song @ 2020-12-05 13:02 UTC (permalink / raw)
  To: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	rafael-DgEjT+Ai2ygdnm+yROfE0A, adobriyan-Re5JQEeQqe8AvxtiuMwx3w,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
	hannes-druUgvl0LCNAfugRpC6u6w, mhocko-DgEjT+Ai2ygdnm+yROfE0A,
	vdavydov.dev-Re5JQEeQqe8AvxtiuMwx3w,
	hughd-hpIqsD4AKlfQT0dZR+AlfA, will-DgEjT+Ai2ygdnm+yROfE0A,
	guro-b10kYP2dOMg, rppt-DgEjT+Ai2ygdnm+yROfE0A,
	tglx-hfZtesqFncYOwBW4kG4KsQ, esyr-H+wXaHxf7aLQT0dZR+AlfA,
	peterx-H+wXaHxf7aLQT0dZR+AlfA, krisman-ZGY8ohtN/8qB+jHODAdFcQ,
	surenb-hpIqsD4AKlfQT0dZR+AlfA, avagin-GEFAQzZX7r8dnm+yROfE0A,
	elver-hpIqsD4AKlfQT0dZR+AlfA, rdunlap-wEGCiKHe2LqWVfeAwA7xHQ,
	iamjoonsoo.kim-Hm3cg6mZ9cc
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA,
	linux-mm-Bw31MaZKKs3YtjvyW6yDsg, cgroups-u79uwXL29TY76Z2rM5mHXA,
	Muchun Song

Convert NR_FILE_PMDMAPPED account to pages

Signed-off-by: Muchun Song <songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>
---
 drivers/base/node.c | 3 +--
 fs/proc/meminfo.c   | 2 +-
 mm/rmap.c           | 6 ++++--
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index fe90888f90a8..679215cdeb87 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -465,8 +465,7 @@ static ssize_t node_read_meminfo(struct device *dev,
 			     nid, K(node_page_state(pgdat, NR_SHMEM_THPS)),
 			     nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED)),
 			     nid, K(node_page_state(pgdat, NR_FILE_THPS)),
-			     nid, K(node_page_state(pgdat, NR_FILE_PMDMAPPED) *
-				    HPAGE_PMD_NR)
+			     nid, K(node_page_state(pgdat, NR_FILE_PMDMAPPED))
 #endif
 			    );
 	len += hugetlb_report_node_meminfo(buf, len, nid);
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index b2bff8359497..a0828df01721 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -137,7 +137,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
 	show_val_kb(m, "FileHugePages:  ",
 		    global_node_page_state(NR_FILE_THPS));
 	show_val_kb(m, "FilePmdMapped:  ",
-		    global_node_page_state(NR_FILE_PMDMAPPED) * HPAGE_PMD_NR);
+		    global_node_page_state(NR_FILE_PMDMAPPED));
 #endif
 
 #ifdef CONFIG_CMA
diff --git a/mm/rmap.c b/mm/rmap.c
index 3089ad6bf468..e383c5619501 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1222,7 +1222,8 @@ void page_add_file_rmap(struct page *page, bool compound)
 			__mod_lruvec_page_state(page, NR_SHMEM_PMDMAPPED,
 						HPAGE_PMD_NR);
 		else
-			__inc_node_page_state(page, NR_FILE_PMDMAPPED);
+			__mod_lruvec_page_state(page, NR_FILE_PMDMAPPED,
+						HPAGE_PMD_NR);
 	} else {
 		if (PageTransCompound(page) && page_mapping(page)) {
 			VM_WARN_ON_ONCE(!PageLocked(page));
@@ -1264,7 +1265,8 @@ static void page_remove_file_rmap(struct page *page, bool compound)
 			__mod_lruvec_page_state(page, NR_SHMEM_PMDMAPPED,
 						-HPAGE_PMD_NR);
 		else
-			__dec_node_page_state(page, NR_FILE_PMDMAPPED);
+			__mod_lruvec_page_state(page, NR_FILE_PMDMAPPED,
+						-HPAGE_PMD_NR);
 	} else {
 		if (!atomic_add_negative(-1, &page->_mapcount))
 			return;
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 9/9] mm: memcontrol: make the slab calculation consistent
  2020-12-05 13:02 [PATCH 0/9] Convert all THP vmstat counters to pages Muchun Song
                   ` (7 preceding siblings ...)
  2020-12-05 13:02   ` Muchun Song
@ 2020-12-05 13:02 ` Muchun Song
  8 siblings, 0 replies; 31+ messages in thread
From: Muchun Song @ 2020-12-05 13:02 UTC (permalink / raw)
  To: gregkh, rafael, adobriyan, akpm, hannes, mhocko, vdavydov.dev,
	hughd, will, guro, rppt, tglx, esyr, peterx, krisman, surenb,
	avagin, elver, rdunlap, iamjoonsoo.kim
  Cc: linux-kernel, linux-fsdevel, linux-mm, cgroups, Muchun Song

Although the ratio of the slab is one, we also should read the ratio
from the related memory_stats instead of hard-coding. And the local
variable of size is already the value of slab_unreclaimable. So we
do not need to read again.

Signed-off-by: Muchun Song <songmuchun@bytedance.com>
---
 mm/memcontrol.c | 112 +++++++++++++++++++++++++++++++++++++-------------------
 1 file changed, 74 insertions(+), 38 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 48d70c1ad301..0e9e8ca7e770 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1493,48 +1493,75 @@ static bool mem_cgroup_wait_acct_move(struct mem_cgroup *memcg)
 
 struct memory_stat {
 	const char *name;
-	unsigned int ratio;
 	unsigned int idx;
 };
 
 static const struct memory_stat memory_stats[] = {
-	{ "anon", PAGE_SIZE, NR_ANON_MAPPED },
-	{ "file", PAGE_SIZE, NR_FILE_PAGES },
-	{ "kernel_stack", 1, NR_KERNEL_STACK_B },
-	{ "percpu", 1, MEMCG_PERCPU_B },
-	{ "sock", PAGE_SIZE, MEMCG_SOCK },
-	{ "shmem", PAGE_SIZE, NR_SHMEM },
-	{ "file_mapped", PAGE_SIZE, NR_FILE_MAPPED },
-	{ "file_dirty", PAGE_SIZE, NR_FILE_DIRTY },
-	{ "file_writeback", PAGE_SIZE, NR_WRITEBACK },
+	{ "anon",			NR_ANON_MAPPED			},
+	{ "file",			NR_FILE_PAGES			},
+	{ "kernel_stack",		NR_KERNEL_STACK_B		},
+	{ "percpu",			MEMCG_PERCPU_B			},
+	{ "sock",			MEMCG_SOCK			},
+	{ "shmem",			NR_SHMEM			},
+	{ "file_mapped",		NR_FILE_MAPPED			},
+	{ "file_dirty",			NR_FILE_DIRTY			},
+	{ "file_writeback",		NR_WRITEBACK			},
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
-	{ "anon_thp", PAGE_SIZE, NR_ANON_THPS },
-	{ "file_thp", PAGE_SIZE, NR_FILE_THPS },
-	{ "shmem_thp", PAGE_SIZE, NR_SHMEM_THPS },
+	{ "anon_thp",			NR_ANON_THPS			},
+	{ "file_thp",			NR_FILE_THPS			},
+	{ "shmem_thp",			NR_SHMEM_THPS			},
 #endif
-	{ "inactive_anon", PAGE_SIZE, NR_INACTIVE_ANON },
-	{ "active_anon", PAGE_SIZE, NR_ACTIVE_ANON },
-	{ "inactive_file", PAGE_SIZE, NR_INACTIVE_FILE },
-	{ "active_file", PAGE_SIZE, NR_ACTIVE_FILE },
-	{ "unevictable", PAGE_SIZE, NR_UNEVICTABLE },
-
-	/*
-	 * Note: The slab_reclaimable and slab_unreclaimable must be
-	 * together and slab_reclaimable must be in front.
-	 */
-	{ "slab_reclaimable", 1, NR_SLAB_RECLAIMABLE_B },
-	{ "slab_unreclaimable", 1, NR_SLAB_UNRECLAIMABLE_B },
+	{ "inactive_anon",		NR_INACTIVE_ANON		},
+	{ "active_anon",		NR_ACTIVE_ANON			},
+	{ "inactive_file",		NR_INACTIVE_FILE		},
+	{ "active_file",		NR_ACTIVE_FILE			},
+	{ "unevictable",		NR_UNEVICTABLE			},
+	{ "slab_reclaimable",		NR_SLAB_RECLAIMABLE_B		},
+	{ "slab_unreclaimable",		NR_SLAB_UNRECLAIMABLE_B		},
 
 	/* The memory events */
-	{ "workingset_refault_anon", 1, WORKINGSET_REFAULT_ANON },
-	{ "workingset_refault_file", 1, WORKINGSET_REFAULT_FILE },
-	{ "workingset_activate_anon", 1, WORKINGSET_ACTIVATE_ANON },
-	{ "workingset_activate_file", 1, WORKINGSET_ACTIVATE_FILE },
-	{ "workingset_restore_anon", 1, WORKINGSET_RESTORE_ANON },
-	{ "workingset_restore_file", 1, WORKINGSET_RESTORE_FILE },
-	{ "workingset_nodereclaim", 1, WORKINGSET_NODERECLAIM },
+	{ "workingset_refault_anon",	WORKINGSET_REFAULT_ANON		},
+	{ "workingset_refault_file",	WORKINGSET_REFAULT_FILE		},
+	{ "workingset_activate_anon",	WORKINGSET_ACTIVATE_ANON	},
+	{ "workingset_activate_file",	WORKINGSET_ACTIVATE_FILE	},
+	{ "workingset_restore_anon",	WORKINGSET_RESTORE_ANON		},
+	{ "workingset_restore_file",	WORKINGSET_RESTORE_FILE		},
+	{ "workingset_nodereclaim",	WORKINGSET_NODERECLAIM		},
 };
 
+/* Translate stat items to the correct unit for memory.stat output */
+static int memcg_page_state_unit(int item)
+{
+	int unit;
+
+	switch (item) {
+	case NR_SLAB_RECLAIMABLE_B:
+	case NR_SLAB_UNRECLAIMABLE_B:
+	case WORKINGSET_REFAULT_ANON:
+	case WORKINGSET_REFAULT_FILE:
+	case WORKINGSET_ACTIVATE_ANON:
+	case WORKINGSET_ACTIVATE_FILE:
+	case WORKINGSET_RESTORE_ANON:
+	case WORKINGSET_RESTORE_FILE:
+	case WORKINGSET_NODERECLAIM:
+	case MEMCG_PERCPU_B:
+	case NR_KERNEL_STACK_B:
+		unit = 1;
+		break;
+	default:
+		unit = PAGE_SIZE;
+		break;
+	}
+
+	return unit;
+}
+
+static inline unsigned long memcg_page_state_output(struct mem_cgroup *memcg,
+						    int item)
+{
+	return memcg_page_state(memcg, item) * memcg_page_state_unit(item);
+}
+
 static char *memory_stat_format(struct mem_cgroup *memcg)
 {
 	struct seq_buf s;
@@ -1558,13 +1585,16 @@ static char *memory_stat_format(struct mem_cgroup *memcg)
 	for (i = 0; i < ARRAY_SIZE(memory_stats); i++) {
 		u64 size;
 
-		size = memcg_page_state(memcg, memory_stats[i].idx);
-		size *= memory_stats[i].ratio;
+		size = memcg_page_state_output(memcg, memory_stats[i].idx);
 		seq_buf_printf(&s, "%s %llu\n", memory_stats[i].name, size);
 
+		/*
+		 * We are printing reclaimable, unreclaimable of the slab
+		 * and the sum of both.
+		 */
 		if (unlikely(memory_stats[i].idx == NR_SLAB_UNRECLAIMABLE_B)) {
-			size = memcg_page_state(memcg, NR_SLAB_RECLAIMABLE_B) +
-			       memcg_page_state(memcg, NR_SLAB_UNRECLAIMABLE_B);
+			size += memcg_page_state_output(memcg,
+							NR_SLAB_RECLAIMABLE_B);
 			seq_buf_printf(&s, "slab %llu\n", size);
 		}
 	}
@@ -6358,6 +6388,12 @@ static int memory_stat_show(struct seq_file *m, void *v)
 }
 
 #ifdef CONFIG_NUMA
+static inline unsigned long lruvec_page_state_output(struct lruvec *lruvec,
+						     int item)
+{
+	return lruvec_page_state(lruvec, item) * memcg_page_state_unit(item);
+}
+
 static int memory_numa_stat_show(struct seq_file *m, void *v)
 {
 	int i;
@@ -6375,8 +6411,8 @@ static int memory_numa_stat_show(struct seq_file *m, void *v)
 			struct lruvec *lruvec;
 
 			lruvec = mem_cgroup_lruvec(memcg, NODE_DATA(nid));
-			size = lruvec_page_state(lruvec, memory_stats[i].idx);
-			size *= memory_stats[i].ratio;
+			size = lruvec_page_state_output(lruvec,
+							memory_stats[i].idx);
 			seq_printf(m, " N%d=%llu", nid, size);
 		}
 		seq_putc(m, '\n');
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Re: [PATCH 3/9] mm: memcontrol: convert kernel stack account to byte-sized
  2020-12-05 13:02 ` [PATCH 3/9] mm: memcontrol: convert kernel stack account to byte-sized Muchun Song
@ 2020-12-05 14:10   ` Greg KH
  0 siblings, 0 replies; 31+ messages in thread
From: Greg KH @ 2020-12-05 14:10 UTC (permalink / raw)
  To: Muchun Song
  Cc: rafael, adobriyan, akpm, hannes, mhocko, vdavydov.dev, hughd,
	will, guro, rppt, tglx, esyr, peterx, krisman, surenb, avagin,
	elver, rdunlap, iamjoonsoo.kim, linux-kernel, linux-fsdevel,
	linux-mm, cgroups

On Sat, Dec 05, 2020 at 09:02:18PM +0800, Muchun Song wrote:
> The kernel stack account is the only one that counts in KiB.
> This patch convert it from KiB to byte.
> 
> Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> ---
>  drivers/base/node.c    | 2 +-
>  fs/proc/meminfo.c      | 2 +-
>  include/linux/mmzone.h | 2 +-
>  kernel/fork.c          | 8 ++++----
>  mm/memcontrol.c        | 2 +-
>  mm/page_alloc.c        | 2 +-
>  mm/vmstat.c            | 4 ++--
>  7 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/base/node.c b/drivers/base/node.c
> index 6ffa470e2984..855886a6ba0e 100644
> --- a/drivers/base/node.c
> +++ b/drivers/base/node.c
> @@ -446,7 +446,7 @@ static ssize_t node_read_meminfo(struct device *dev,
>  			     nid, K(node_page_state(pgdat, NR_FILE_MAPPED)),
>  			     nid, K(node_page_state(pgdat, NR_ANON_MAPPED)),
>  			     nid, K(i.sharedram),
> -			     nid, node_page_state(pgdat, NR_KERNEL_STACK_KB),
> +			     nid, node_page_state(pgdat, NR_KERNEL_STACK_B) / 1024,

Did you just change the units of a userspace-visable file without
updating the documentation?

If not, how is this working?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 5/9] mm: memcontrol: convert NR_FILE_THPS account to pages
@ 2020-12-05 14:10     ` Greg KH
  0 siblings, 0 replies; 31+ messages in thread
From: Greg KH @ 2020-12-05 14:10 UTC (permalink / raw)
  To: Muchun Song
  Cc: rafael, adobriyan, akpm, hannes, mhocko, vdavydov.dev, hughd,
	will, guro, rppt, tglx, esyr, peterx, krisman, surenb, avagin,
	elver, rdunlap, iamjoonsoo.kim, linux-kernel, linux-fsdevel,
	linux-mm, cgroups

On Sat, Dec 05, 2020 at 09:02:20PM +0800, Muchun Song wrote:
> Converrt NR_FILE_THPS account to pages.
> 
> Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> ---
>  drivers/base/node.c | 3 +--
>  fs/proc/meminfo.c   | 2 +-
>  mm/filemap.c        | 2 +-
>  mm/huge_memory.c    | 3 ++-
>  mm/khugepaged.c     | 2 +-
>  mm/memcontrol.c     | 5 ++---
>  6 files changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/base/node.c b/drivers/base/node.c
> index 05c369e93e16..f6a9521bbcf8 100644
> --- a/drivers/base/node.c
> +++ b/drivers/base/node.c
> @@ -466,8 +466,7 @@ static ssize_t node_read_meminfo(struct device *dev,
>  				    HPAGE_PMD_NR),
>  			     nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) *
>  				    HPAGE_PMD_NR),
> -			     nid, K(node_page_state(pgdat, NR_FILE_THPS) *
> -				    HPAGE_PMD_NR),
> +			     nid, K(node_page_state(pgdat, NR_FILE_THPS)),

Again, is this changing a user-visable value?


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 5/9] mm: memcontrol: convert NR_FILE_THPS account to pages
@ 2020-12-05 14:10     ` Greg KH
  0 siblings, 0 replies; 31+ messages in thread
From: Greg KH @ 2020-12-05 14:10 UTC (permalink / raw)
  To: Muchun Song
  Cc: rafael-DgEjT+Ai2ygdnm+yROfE0A, adobriyan-Re5JQEeQqe8AvxtiuMwx3w,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
	hannes-druUgvl0LCNAfugRpC6u6w, mhocko-DgEjT+Ai2ygdnm+yROfE0A,
	vdavydov.dev-Re5JQEeQqe8AvxtiuMwx3w,
	hughd-hpIqsD4AKlfQT0dZR+AlfA, will-DgEjT+Ai2ygdnm+yROfE0A,
	guro-b10kYP2dOMg, rppt-DgEjT+Ai2ygdnm+yROfE0A,
	tglx-hfZtesqFncYOwBW4kG4KsQ, esyr-H+wXaHxf7aLQT0dZR+AlfA,
	peterx-H+wXaHxf7aLQT0dZR+AlfA, krisman-ZGY8ohtN/8qB+jHODAdFcQ,
	surenb-hpIqsD4AKlfQT0dZR+AlfA, avagin-GEFAQzZX7r8dnm+yROfE0A,
	elver-hpIqsD4AKlfQT0dZR+AlfA, rdunlap-wEGCiKHe2LqWVfeAwA7xHQ,
	iamjoonsoo.kim-Hm3cg6mZ9cc, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA,
	linux-mm-Bw31MaZKKs3YtjvyW6yDsg, cgroups-u79uwXL29TY76Z2rM5mHXA

On Sat, Dec 05, 2020 at 09:02:20PM +0800, Muchun Song wrote:
> Converrt NR_FILE_THPS account to pages.
> 
> Signed-off-by: Muchun Song <songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>
> ---
>  drivers/base/node.c | 3 +--
>  fs/proc/meminfo.c   | 2 +-
>  mm/filemap.c        | 2 +-
>  mm/huge_memory.c    | 3 ++-
>  mm/khugepaged.c     | 2 +-
>  mm/memcontrol.c     | 5 ++---
>  6 files changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/base/node.c b/drivers/base/node.c
> index 05c369e93e16..f6a9521bbcf8 100644
> --- a/drivers/base/node.c
> +++ b/drivers/base/node.c
> @@ -466,8 +466,7 @@ static ssize_t node_read_meminfo(struct device *dev,
>  				    HPAGE_PMD_NR),
>  			     nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) *
>  				    HPAGE_PMD_NR),
> -			     nid, K(node_page_state(pgdat, NR_FILE_THPS) *
> -				    HPAGE_PMD_NR),
> +			     nid, K(node_page_state(pgdat, NR_FILE_THPS)),

Again, is this changing a user-visable value?


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [External] Re: [PATCH 5/9] mm: memcontrol: convert NR_FILE_THPS account to pages
  2020-12-05 14:10     ` Greg KH
  (?)
@ 2020-12-05 15:29       ` Muchun Song
  -1 siblings, 0 replies; 31+ messages in thread
From: Muchun Song @ 2020-12-05 15:29 UTC (permalink / raw)
  To: Greg KH
  Cc: rafael, Alexey Dobriyan, Andrew Morton, Johannes Weiner,
	Michal Hocko, Vladimir Davydov, Hugh Dickins, Will Deacon,
	Roman Gushchin, Mike Rapoport, Thomas Gleixner, esyr, peterx,
	krisman, Suren Baghdasaryan, avagin, Marco Elver, Randy Dunlap,
	Joonsoo Kim, LKML, linux-fsdevel, Linux Memory Management List,
	Cgroups

On Sat, Dec 5, 2020 at 10:09 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Sat, Dec 05, 2020 at 09:02:20PM +0800, Muchun Song wrote:
> > Converrt NR_FILE_THPS account to pages.
> >
> > Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> > ---
> >  drivers/base/node.c | 3 +--
> >  fs/proc/meminfo.c   | 2 +-
> >  mm/filemap.c        | 2 +-
> >  mm/huge_memory.c    | 3 ++-
> >  mm/khugepaged.c     | 2 +-
> >  mm/memcontrol.c     | 5 ++---
> >  6 files changed, 8 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/base/node.c b/drivers/base/node.c
> > index 05c369e93e16..f6a9521bbcf8 100644
> > --- a/drivers/base/node.c
> > +++ b/drivers/base/node.c
> > @@ -466,8 +466,7 @@ static ssize_t node_read_meminfo(struct device *dev,
> >                                   HPAGE_PMD_NR),
> >                            nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) *
> >                                   HPAGE_PMD_NR),
> > -                          nid, K(node_page_state(pgdat, NR_FILE_THPS) *
> > -                                 HPAGE_PMD_NR),
> > +                          nid, K(node_page_state(pgdat, NR_FILE_THPS)),
>
> Again, is this changing a user-visable value?
>

Of course not.

In the previous, the NR_FILE_THPS account is like below:

    __mod_lruvec_page_state(page, NR_FILE_THPS, 1);

With this patch, it is:

    __mod_lruvec_page_state(page, NR_FILE_THPS, HPAGE_PMD_NR);

So the result is not changed from the view of user space.

Thanks.

--
Yours,
Muchun

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [External] Re: [PATCH 5/9] mm: memcontrol: convert NR_FILE_THPS account to pages
@ 2020-12-05 15:29       ` Muchun Song
  0 siblings, 0 replies; 31+ messages in thread
From: Muchun Song @ 2020-12-05 15:29 UTC (permalink / raw)
  To: Greg KH
  Cc: rafael, Alexey Dobriyan, Andrew Morton, Johannes Weiner,
	Michal Hocko, Vladimir Davydov, Hugh Dickins, Will Deacon,
	Roman Gushchin, Mike Rapoport, Thomas Gleixner, esyr, peterx,
	krisman, Suren Baghdasaryan, avagin, Marco Elver, Randy Dunlap,
	Joonsoo Kim, LKML, linux-fsdevel, Linux Memory Management List,
	Cgroups

On Sat, Dec 5, 2020 at 10:09 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Sat, Dec 05, 2020 at 09:02:20PM +0800, Muchun Song wrote:
> > Converrt NR_FILE_THPS account to pages.
> >
> > Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> > ---
> >  drivers/base/node.c | 3 +--
> >  fs/proc/meminfo.c   | 2 +-
> >  mm/filemap.c        | 2 +-
> >  mm/huge_memory.c    | 3 ++-
> >  mm/khugepaged.c     | 2 +-
> >  mm/memcontrol.c     | 5 ++---
> >  6 files changed, 8 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/base/node.c b/drivers/base/node.c
> > index 05c369e93e16..f6a9521bbcf8 100644
> > --- a/drivers/base/node.c
> > +++ b/drivers/base/node.c
> > @@ -466,8 +466,7 @@ static ssize_t node_read_meminfo(struct device *dev,
> >                                   HPAGE_PMD_NR),
> >                            nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) *
> >                                   HPAGE_PMD_NR),
> > -                          nid, K(node_page_state(pgdat, NR_FILE_THPS) *
> > -                                 HPAGE_PMD_NR),
> > +                          nid, K(node_page_state(pgdat, NR_FILE_THPS)),
>
> Again, is this changing a user-visable value?
>

Of course not.

In the previous, the NR_FILE_THPS account is like below:

    __mod_lruvec_page_state(page, NR_FILE_THPS, 1);

With this patch, it is:

    __mod_lruvec_page_state(page, NR_FILE_THPS, HPAGE_PMD_NR);

So the result is not changed from the view of user space.

Thanks.

--
Yours,
Muchun


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [External] Re: [PATCH 5/9] mm: memcontrol: convert NR_FILE_THPS account to pages
@ 2020-12-05 15:29       ` Muchun Song
  0 siblings, 0 replies; 31+ messages in thread
From: Muchun Song @ 2020-12-05 15:29 UTC (permalink / raw)
  To: Greg KH
  Cc: rafael, Alexey Dobriyan, Andrew Morton, Johannes Weiner,
	Michal Hocko, Vladimir Davydov, Hugh Dickins, Will Deacon,
	Roman Gushchin, Mike Rapoport, Thomas Gleixner, esyr, peterx,
	krisman, Suren Baghdasaryan, avagin, Marco Elver, Randy Dunlap,
	Joonsoo Kim, LKML, linux-fsdevel, Linux Memory Management List,
	Cgroups

On Sat, Dec 5, 2020 at 10:09 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Sat, Dec 05, 2020 at 09:02:20PM +0800, Muchun Song wrote:
> > Converrt NR_FILE_THPS account to pages.
> >
> > Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> > ---
> >  drivers/base/node.c | 3 +--
> >  fs/proc/meminfo.c   | 2 +-
> >  mm/filemap.c        | 2 +-
> >  mm/huge_memory.c    | 3 ++-
> >  mm/khugepaged.c     | 2 +-
> >  mm/memcontrol.c     | 5 ++---
> >  6 files changed, 8 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/base/node.c b/drivers/base/node.c
> > index 05c369e93e16..f6a9521bbcf8 100644
> > --- a/drivers/base/node.c
> > +++ b/drivers/base/node.c
> > @@ -466,8 +466,7 @@ static ssize_t node_read_meminfo(struct device *dev,
> >                                   HPAGE_PMD_NR),
> >                            nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) *
> >                                   HPAGE_PMD_NR),
> > -                          nid, K(node_page_state(pgdat, NR_FILE_THPS) *
> > -                                 HPAGE_PMD_NR),
> > +                          nid, K(node_page_state(pgdat, NR_FILE_THPS)),
>
> Again, is this changing a user-visable value?
>

Of course not.

In the previous, the NR_FILE_THPS account is like below:

    __mod_lruvec_page_state(page, NR_FILE_THPS, 1);

With this patch, it is:

    __mod_lruvec_page_state(page, NR_FILE_THPS, HPAGE_PMD_NR);

So the result is not changed from the view of user space.

Thanks.

--
Yours,
Muchun

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [External] Re: [PATCH 5/9] mm: memcontrol: convert NR_FILE_THPS account to pages
  2020-12-05 15:29       ` Muchun Song
@ 2020-12-05 15:32         ` Greg KH
  -1 siblings, 0 replies; 31+ messages in thread
From: Greg KH @ 2020-12-05 15:32 UTC (permalink / raw)
  To: Muchun Song
  Cc: rafael, Alexey Dobriyan, Andrew Morton, Johannes Weiner,
	Michal Hocko, Vladimir Davydov, Hugh Dickins, Will Deacon,
	Roman Gushchin, Mike Rapoport, Thomas Gleixner, esyr, peterx,
	krisman, Suren Baghdasaryan, avagin, Marco Elver, Randy Dunlap,
	Joonsoo Kim, LKML, linux-fsdevel, Linux Memory Management List,
	Cgroups

On Sat, Dec 05, 2020 at 11:29:26PM +0800, Muchun Song wrote:
> On Sat, Dec 5, 2020 at 10:09 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> >
> > On Sat, Dec 05, 2020 at 09:02:20PM +0800, Muchun Song wrote:
> > > Converrt NR_FILE_THPS account to pages.
> > >
> > > Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> > > ---
> > >  drivers/base/node.c | 3 +--
> > >  fs/proc/meminfo.c   | 2 +-
> > >  mm/filemap.c        | 2 +-
> > >  mm/huge_memory.c    | 3 ++-
> > >  mm/khugepaged.c     | 2 +-
> > >  mm/memcontrol.c     | 5 ++---
> > >  6 files changed, 8 insertions(+), 9 deletions(-)
> > >
> > > diff --git a/drivers/base/node.c b/drivers/base/node.c
> > > index 05c369e93e16..f6a9521bbcf8 100644
> > > --- a/drivers/base/node.c
> > > +++ b/drivers/base/node.c
> > > @@ -466,8 +466,7 @@ static ssize_t node_read_meminfo(struct device *dev,
> > >                                   HPAGE_PMD_NR),
> > >                            nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) *
> > >                                   HPAGE_PMD_NR),
> > > -                          nid, K(node_page_state(pgdat, NR_FILE_THPS) *
> > > -                                 HPAGE_PMD_NR),
> > > +                          nid, K(node_page_state(pgdat, NR_FILE_THPS)),
> >
> > Again, is this changing a user-visable value?
> >
> 
> Of course not.
> 
> In the previous, the NR_FILE_THPS account is like below:
> 
>     __mod_lruvec_page_state(page, NR_FILE_THPS, 1);
> 
> With this patch, it is:
> 
>     __mod_lruvec_page_state(page, NR_FILE_THPS, HPAGE_PMD_NR);
> 
> So the result is not changed from the view of user space.

So you "broke" it on the previous patch and "fixed" it on this one?  Why
not just do it all in one patch?

Confused,

greg k-h

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [External] Re: [PATCH 5/9] mm: memcontrol: convert NR_FILE_THPS account to pages
@ 2020-12-05 15:32         ` Greg KH
  0 siblings, 0 replies; 31+ messages in thread
From: Greg KH @ 2020-12-05 15:32 UTC (permalink / raw)
  To: Muchun Song
  Cc: rafael-DgEjT+Ai2ygdnm+yROfE0A, Alexey Dobriyan, Andrew Morton,
	Johannes Weiner, Michal Hocko, Vladimir Davydov, Hugh Dickins,
	Will Deacon, Roman Gushchin, Mike Rapoport, Thomas Gleixner,
	esyr-H+wXaHxf7aLQT0dZR+AlfA, peterx-H+wXaHxf7aLQT0dZR+AlfA,
	krisman-ZGY8ohtN/8qB+jHODAdFcQ, Suren Baghdasaryan,
	avagin-GEFAQzZX7r8dnm+yROfE0A, Marco Elver, Randy Dunlap,
	Joonsoo Kim, LKML, linux-fsdevel, Linux Memory Management List,
	Cgroups

On Sat, Dec 05, 2020 at 11:29:26PM +0800, Muchun Song wrote:
> On Sat, Dec 5, 2020 at 10:09 PM Greg KH <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org> wrote:
> >
> > On Sat, Dec 05, 2020 at 09:02:20PM +0800, Muchun Song wrote:
> > > Converrt NR_FILE_THPS account to pages.
> > >
> > > Signed-off-by: Muchun Song <songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>
> > > ---
> > >  drivers/base/node.c | 3 +--
> > >  fs/proc/meminfo.c   | 2 +-
> > >  mm/filemap.c        | 2 +-
> > >  mm/huge_memory.c    | 3 ++-
> > >  mm/khugepaged.c     | 2 +-
> > >  mm/memcontrol.c     | 5 ++---
> > >  6 files changed, 8 insertions(+), 9 deletions(-)
> > >
> > > diff --git a/drivers/base/node.c b/drivers/base/node.c
> > > index 05c369e93e16..f6a9521bbcf8 100644
> > > --- a/drivers/base/node.c
> > > +++ b/drivers/base/node.c
> > > @@ -466,8 +466,7 @@ static ssize_t node_read_meminfo(struct device *dev,
> > >                                   HPAGE_PMD_NR),
> > >                            nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) *
> > >                                   HPAGE_PMD_NR),
> > > -                          nid, K(node_page_state(pgdat, NR_FILE_THPS) *
> > > -                                 HPAGE_PMD_NR),
> > > +                          nid, K(node_page_state(pgdat, NR_FILE_THPS)),
> >
> > Again, is this changing a user-visable value?
> >
> 
> Of course not.
> 
> In the previous, the NR_FILE_THPS account is like below:
> 
>     __mod_lruvec_page_state(page, NR_FILE_THPS, 1);
> 
> With this patch, it is:
> 
>     __mod_lruvec_page_state(page, NR_FILE_THPS, HPAGE_PMD_NR);
> 
> So the result is not changed from the view of user space.

So you "broke" it on the previous patch and "fixed" it on this one?  Why
not just do it all in one patch?

Confused,

greg k-h

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [External] Re: [PATCH 5/9] mm: memcontrol: convert NR_FILE_THPS account to pages
  2020-12-05 15:32         ` Greg KH
  (?)
@ 2020-12-05 15:39           ` Muchun Song
  -1 siblings, 0 replies; 31+ messages in thread
From: Muchun Song @ 2020-12-05 15:39 UTC (permalink / raw)
  To: Greg KH
  Cc: rafael, Alexey Dobriyan, Andrew Morton, Johannes Weiner,
	Michal Hocko, Vladimir Davydov, Hugh Dickins, Will Deacon,
	Roman Gushchin, Mike Rapoport, Thomas Gleixner, esyr, peterx,
	krisman, Suren Baghdasaryan, avagin, Marco Elver, Randy Dunlap,
	Joonsoo Kim, LKML, linux-fsdevel, Linux Memory Management List,
	Cgroups

On Sat, Dec 5, 2020 at 11:32 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Sat, Dec 05, 2020 at 11:29:26PM +0800, Muchun Song wrote:
> > On Sat, Dec 5, 2020 at 10:09 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> > >
> > > On Sat, Dec 05, 2020 at 09:02:20PM +0800, Muchun Song wrote:
> > > > Converrt NR_FILE_THPS account to pages.
> > > >
> > > > Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> > > > ---
> > > >  drivers/base/node.c | 3 +--
> > > >  fs/proc/meminfo.c   | 2 +-
> > > >  mm/filemap.c        | 2 +-
> > > >  mm/huge_memory.c    | 3 ++-
> > > >  mm/khugepaged.c     | 2 +-
> > > >  mm/memcontrol.c     | 5 ++---
> > > >  6 files changed, 8 insertions(+), 9 deletions(-)
> > > >
> > > > diff --git a/drivers/base/node.c b/drivers/base/node.c
> > > > index 05c369e93e16..f6a9521bbcf8 100644
> > > > --- a/drivers/base/node.c
> > > > +++ b/drivers/base/node.c
> > > > @@ -466,8 +466,7 @@ static ssize_t node_read_meminfo(struct device *dev,
> > > >                                   HPAGE_PMD_NR),
> > > >                            nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) *
> > > >                                   HPAGE_PMD_NR),
> > > > -                          nid, K(node_page_state(pgdat, NR_FILE_THPS) *
> > > > -                                 HPAGE_PMD_NR),
> > > > +                          nid, K(node_page_state(pgdat, NR_FILE_THPS)),
> > >
> > > Again, is this changing a user-visable value?
> > >
> >
> > Of course not.
> >
> > In the previous, the NR_FILE_THPS account is like below:
> >
> >     __mod_lruvec_page_state(page, NR_FILE_THPS, 1);
> >
> > With this patch, it is:
> >
> >     __mod_lruvec_page_state(page, NR_FILE_THPS, HPAGE_PMD_NR);
> >
> > So the result is not changed from the view of user space.
>
> So you "broke" it on the previous patch and "fixed" it on this one?  Why
> not just do it all in one patch?

Sorry for the confusion. I mean that the "previous" is without all of this patch
series. So this series is aimed to convert the unit of all different THP vmstat
counters from HPAGE_PMD_NR to pages. Thanks.

>
> Confused,
>
> greg k-h



-- 
Yours,
Muchun

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [External] Re: [PATCH 5/9] mm: memcontrol: convert NR_FILE_THPS account to pages
@ 2020-12-05 15:39           ` Muchun Song
  0 siblings, 0 replies; 31+ messages in thread
From: Muchun Song @ 2020-12-05 15:39 UTC (permalink / raw)
  To: Greg KH
  Cc: rafael, Alexey Dobriyan, Andrew Morton, Johannes Weiner,
	Michal Hocko, Vladimir Davydov, Hugh Dickins, Will Deacon,
	Roman Gushchin, Mike Rapoport, Thomas Gleixner, esyr, peterx,
	krisman, Suren Baghdasaryan, avagin, Marco Elver, Randy Dunlap,
	Joonsoo Kim, LKML, linux-fsdevel, Linux Memory Management List,
	Cgroups

On Sat, Dec 5, 2020 at 11:32 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Sat, Dec 05, 2020 at 11:29:26PM +0800, Muchun Song wrote:
> > On Sat, Dec 5, 2020 at 10:09 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> > >
> > > On Sat, Dec 05, 2020 at 09:02:20PM +0800, Muchun Song wrote:
> > > > Converrt NR_FILE_THPS account to pages.
> > > >
> > > > Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> > > > ---
> > > >  drivers/base/node.c | 3 +--
> > > >  fs/proc/meminfo.c   | 2 +-
> > > >  mm/filemap.c        | 2 +-
> > > >  mm/huge_memory.c    | 3 ++-
> > > >  mm/khugepaged.c     | 2 +-
> > > >  mm/memcontrol.c     | 5 ++---
> > > >  6 files changed, 8 insertions(+), 9 deletions(-)
> > > >
> > > > diff --git a/drivers/base/node.c b/drivers/base/node.c
> > > > index 05c369e93e16..f6a9521bbcf8 100644
> > > > --- a/drivers/base/node.c
> > > > +++ b/drivers/base/node.c
> > > > @@ -466,8 +466,7 @@ static ssize_t node_read_meminfo(struct device *dev,
> > > >                                   HPAGE_PMD_NR),
> > > >                            nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) *
> > > >                                   HPAGE_PMD_NR),
> > > > -                          nid, K(node_page_state(pgdat, NR_FILE_THPS) *
> > > > -                                 HPAGE_PMD_NR),
> > > > +                          nid, K(node_page_state(pgdat, NR_FILE_THPS)),
> > >
> > > Again, is this changing a user-visable value?
> > >
> >
> > Of course not.
> >
> > In the previous, the NR_FILE_THPS account is like below:
> >
> >     __mod_lruvec_page_state(page, NR_FILE_THPS, 1);
> >
> > With this patch, it is:
> >
> >     __mod_lruvec_page_state(page, NR_FILE_THPS, HPAGE_PMD_NR);
> >
> > So the result is not changed from the view of user space.
>
> So you "broke" it on the previous patch and "fixed" it on this one?  Why
> not just do it all in one patch?

Sorry for the confusion. I mean that the "previous" is without all of this patch
series. So this series is aimed to convert the unit of all different THP vmstat
counters from HPAGE_PMD_NR to pages. Thanks.

>
> Confused,
>
> greg k-h



-- 
Yours,
Muchun


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [External] Re: [PATCH 5/9] mm: memcontrol: convert NR_FILE_THPS account to pages
@ 2020-12-05 15:39           ` Muchun Song
  0 siblings, 0 replies; 31+ messages in thread
From: Muchun Song @ 2020-12-05 15:39 UTC (permalink / raw)
  To: Greg KH
  Cc: rafael, Alexey Dobriyan, Andrew Morton, Johannes Weiner,
	Michal Hocko, Vladimir Davydov, Hugh Dickins, Will Deacon,
	Roman Gushchin, Mike Rapoport, Thomas Gleixner, esyr, peterx,
	krisman, Suren Baghdasaryan, avagin, Marco Elver, Randy Dunlap,
	Joonsoo Kim, LKML, linux-fsdevel, Linux Memory Management List,
	Cgroups

On Sat, Dec 5, 2020 at 11:32 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Sat, Dec 05, 2020 at 11:29:26PM +0800, Muchun Song wrote:
> > On Sat, Dec 5, 2020 at 10:09 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> > >
> > > On Sat, Dec 05, 2020 at 09:02:20PM +0800, Muchun Song wrote:
> > > > Converrt NR_FILE_THPS account to pages.
> > > >
> > > > Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> > > > ---
> > > >  drivers/base/node.c | 3 +--
> > > >  fs/proc/meminfo.c   | 2 +-
> > > >  mm/filemap.c        | 2 +-
> > > >  mm/huge_memory.c    | 3 ++-
> > > >  mm/khugepaged.c     | 2 +-
> > > >  mm/memcontrol.c     | 5 ++---
> > > >  6 files changed, 8 insertions(+), 9 deletions(-)
> > > >
> > > > diff --git a/drivers/base/node.c b/drivers/base/node.c
> > > > index 05c369e93e16..f6a9521bbcf8 100644
> > > > --- a/drivers/base/node.c
> > > > +++ b/drivers/base/node.c
> > > > @@ -466,8 +466,7 @@ static ssize_t node_read_meminfo(struct device *dev,
> > > >                                   HPAGE_PMD_NR),
> > > >                            nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) *
> > > >                                   HPAGE_PMD_NR),
> > > > -                          nid, K(node_page_state(pgdat, NR_FILE_THPS) *
> > > > -                                 HPAGE_PMD_NR),
> > > > +                          nid, K(node_page_state(pgdat, NR_FILE_THPS)),
> > >
> > > Again, is this changing a user-visable value?
> > >
> >
> > Of course not.
> >
> > In the previous, the NR_FILE_THPS account is like below:
> >
> >     __mod_lruvec_page_state(page, NR_FILE_THPS, 1);
> >
> > With this patch, it is:
> >
> >     __mod_lruvec_page_state(page, NR_FILE_THPS, HPAGE_PMD_NR);
> >
> > So the result is not changed from the view of user space.
>
> So you "broke" it on the previous patch and "fixed" it on this one?  Why
> not just do it all in one patch?

Sorry for the confusion. I mean that the "previous" is without all of this patch
series. So this series is aimed to convert the unit of all different THP vmstat
counters from HPAGE_PMD_NR to pages. Thanks.

>
> Confused,
>
> greg k-h



-- 
Yours,
Muchun

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [External] Re: [PATCH 5/9] mm: memcontrol: convert NR_FILE_THPS account to pages
@ 2020-12-05 16:33             ` Greg KH
  0 siblings, 0 replies; 31+ messages in thread
From: Greg KH @ 2020-12-05 16:33 UTC (permalink / raw)
  To: Muchun Song
  Cc: rafael, Alexey Dobriyan, Andrew Morton, Johannes Weiner,
	Michal Hocko, Vladimir Davydov, Hugh Dickins, Will Deacon,
	Roman Gushchin, Mike Rapoport, Thomas Gleixner, esyr, peterx,
	krisman, Suren Baghdasaryan, avagin, Marco Elver, Randy Dunlap,
	Joonsoo Kim, LKML, linux-fsdevel, Linux Memory Management List,
	Cgroups

On Sat, Dec 05, 2020 at 11:39:24PM +0800, Muchun Song wrote:
> On Sat, Dec 5, 2020 at 11:32 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> >
> > On Sat, Dec 05, 2020 at 11:29:26PM +0800, Muchun Song wrote:
> > > On Sat, Dec 5, 2020 at 10:09 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> > > >
> > > > On Sat, Dec 05, 2020 at 09:02:20PM +0800, Muchun Song wrote:
> > > > > Converrt NR_FILE_THPS account to pages.
> > > > >
> > > > > Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> > > > > ---
> > > > >  drivers/base/node.c | 3 +--
> > > > >  fs/proc/meminfo.c   | 2 +-
> > > > >  mm/filemap.c        | 2 +-
> > > > >  mm/huge_memory.c    | 3 ++-
> > > > >  mm/khugepaged.c     | 2 +-
> > > > >  mm/memcontrol.c     | 5 ++---
> > > > >  6 files changed, 8 insertions(+), 9 deletions(-)
> > > > >
> > > > > diff --git a/drivers/base/node.c b/drivers/base/node.c
> > > > > index 05c369e93e16..f6a9521bbcf8 100644
> > > > > --- a/drivers/base/node.c
> > > > > +++ b/drivers/base/node.c
> > > > > @@ -466,8 +466,7 @@ static ssize_t node_read_meminfo(struct device *dev,
> > > > >                                   HPAGE_PMD_NR),
> > > > >                            nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) *
> > > > >                                   HPAGE_PMD_NR),
> > > > > -                          nid, K(node_page_state(pgdat, NR_FILE_THPS) *
> > > > > -                                 HPAGE_PMD_NR),
> > > > > +                          nid, K(node_page_state(pgdat, NR_FILE_THPS)),
> > > >
> > > > Again, is this changing a user-visable value?
> > > >
> > >
> > > Of course not.
> > >
> > > In the previous, the NR_FILE_THPS account is like below:
> > >
> > >     __mod_lruvec_page_state(page, NR_FILE_THPS, 1);
> > >
> > > With this patch, it is:
> > >
> > >     __mod_lruvec_page_state(page, NR_FILE_THPS, HPAGE_PMD_NR);
> > >
> > > So the result is not changed from the view of user space.
> >
> > So you "broke" it on the previous patch and "fixed" it on this one?  Why
> > not just do it all in one patch?
> 
> Sorry for the confusion. I mean that the "previous" is without all of this patch
> series. So this series is aimed to convert the unit of all different THP vmstat
> counters from HPAGE_PMD_NR to pages. Thanks.

I'm sorry, I still do not understand.  It looks to me that you are
changing the number printed to userspace here.  Where is the
corrisponding change that changed the units for this function?  Is it in
this patch?  If so, sorry, I did not see that at all...

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [External] Re: [PATCH 5/9] mm: memcontrol: convert NR_FILE_THPS account to pages
@ 2020-12-05 16:33             ` Greg KH
  0 siblings, 0 replies; 31+ messages in thread
From: Greg KH @ 2020-12-05 16:33 UTC (permalink / raw)
  To: Muchun Song
  Cc: rafael-DgEjT+Ai2ygdnm+yROfE0A, Alexey Dobriyan, Andrew Morton,
	Johannes Weiner, Michal Hocko, Vladimir Davydov, Hugh Dickins,
	Will Deacon, Roman Gushchin, Mike Rapoport, Thomas Gleixner,
	esyr-H+wXaHxf7aLQT0dZR+AlfA, peterx-H+wXaHxf7aLQT0dZR+AlfA,
	krisman-ZGY8ohtN/8qB+jHODAdFcQ, Suren Baghdasaryan,
	avagin-GEFAQzZX7r8dnm+yROfE0A, Marco Elver, Randy Dunlap,
	Joonsoo Kim, LKML, linux-fsdevel, Linux Memory Management List,
	Cgroups

On Sat, Dec 05, 2020 at 11:39:24PM +0800, Muchun Song wrote:
> On Sat, Dec 5, 2020 at 11:32 PM Greg KH <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org> wrote:
> >
> > On Sat, Dec 05, 2020 at 11:29:26PM +0800, Muchun Song wrote:
> > > On Sat, Dec 5, 2020 at 10:09 PM Greg KH <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org> wrote:
> > > >
> > > > On Sat, Dec 05, 2020 at 09:02:20PM +0800, Muchun Song wrote:
> > > > > Converrt NR_FILE_THPS account to pages.
> > > > >
> > > > > Signed-off-by: Muchun Song <songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>
> > > > > ---
> > > > >  drivers/base/node.c | 3 +--
> > > > >  fs/proc/meminfo.c   | 2 +-
> > > > >  mm/filemap.c        | 2 +-
> > > > >  mm/huge_memory.c    | 3 ++-
> > > > >  mm/khugepaged.c     | 2 +-
> > > > >  mm/memcontrol.c     | 5 ++---
> > > > >  6 files changed, 8 insertions(+), 9 deletions(-)
> > > > >
> > > > > diff --git a/drivers/base/node.c b/drivers/base/node.c
> > > > > index 05c369e93e16..f6a9521bbcf8 100644
> > > > > --- a/drivers/base/node.c
> > > > > +++ b/drivers/base/node.c
> > > > > @@ -466,8 +466,7 @@ static ssize_t node_read_meminfo(struct device *dev,
> > > > >                                   HPAGE_PMD_NR),
> > > > >                            nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) *
> > > > >                                   HPAGE_PMD_NR),
> > > > > -                          nid, K(node_page_state(pgdat, NR_FILE_THPS) *
> > > > > -                                 HPAGE_PMD_NR),
> > > > > +                          nid, K(node_page_state(pgdat, NR_FILE_THPS)),
> > > >
> > > > Again, is this changing a user-visable value?
> > > >
> > >
> > > Of course not.
> > >
> > > In the previous, the NR_FILE_THPS account is like below:
> > >
> > >     __mod_lruvec_page_state(page, NR_FILE_THPS, 1);
> > >
> > > With this patch, it is:
> > >
> > >     __mod_lruvec_page_state(page, NR_FILE_THPS, HPAGE_PMD_NR);
> > >
> > > So the result is not changed from the view of user space.
> >
> > So you "broke" it on the previous patch and "fixed" it on this one?  Why
> > not just do it all in one patch?
> 
> Sorry for the confusion. I mean that the "previous" is without all of this patch
> series. So this series is aimed to convert the unit of all different THP vmstat
> counters from HPAGE_PMD_NR to pages. Thanks.

I'm sorry, I still do not understand.  It looks to me that you are
changing the number printed to userspace here.  Where is the
corrisponding change that changed the units for this function?  Is it in
this patch?  If so, sorry, I did not see that at all...

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [External] Re: [PATCH 5/9] mm: memcontrol: convert NR_FILE_THPS account to pages
  2020-12-05 16:33             ` Greg KH
  (?)
@ 2020-12-05 16:52               ` Muchun Song
  -1 siblings, 0 replies; 31+ messages in thread
From: Muchun Song @ 2020-12-05 16:52 UTC (permalink / raw)
  To: Greg KH
  Cc: rafael, Alexey Dobriyan, Andrew Morton, Johannes Weiner,
	Michal Hocko, Vladimir Davydov, Hugh Dickins, Will Deacon,
	Roman Gushchin, Mike Rapoport, Thomas Gleixner, esyr, peterx,
	krisman, Suren Baghdasaryan, avagin, Marco Elver, Randy Dunlap,
	Joonsoo Kim, LKML, linux-fsdevel, Linux Memory Management List,
	Cgroups

On Sun, Dec 6, 2020 at 12:32 AM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Sat, Dec 05, 2020 at 11:39:24PM +0800, Muchun Song wrote:
> > On Sat, Dec 5, 2020 at 11:32 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> > >
> > > On Sat, Dec 05, 2020 at 11:29:26PM +0800, Muchun Song wrote:
> > > > On Sat, Dec 5, 2020 at 10:09 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> > > > >
> > > > > On Sat, Dec 05, 2020 at 09:02:20PM +0800, Muchun Song wrote:
> > > > > > Converrt NR_FILE_THPS account to pages.
> > > > > >
> > > > > > Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> > > > > > ---
> > > > > >  drivers/base/node.c | 3 +--
> > > > > >  fs/proc/meminfo.c   | 2 +-
> > > > > >  mm/filemap.c        | 2 +-
> > > > > >  mm/huge_memory.c    | 3 ++-
> > > > > >  mm/khugepaged.c     | 2 +-
> > > > > >  mm/memcontrol.c     | 5 ++---
> > > > > >  6 files changed, 8 insertions(+), 9 deletions(-)
> > > > > >
> > > > > > diff --git a/drivers/base/node.c b/drivers/base/node.c
> > > > > > index 05c369e93e16..f6a9521bbcf8 100644
> > > > > > --- a/drivers/base/node.c
> > > > > > +++ b/drivers/base/node.c
> > > > > > @@ -466,8 +466,7 @@ static ssize_t node_read_meminfo(struct device *dev,
> > > > > >                                   HPAGE_PMD_NR),
> > > > > >                            nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) *
> > > > > >                                   HPAGE_PMD_NR),
> > > > > > -                          nid, K(node_page_state(pgdat, NR_FILE_THPS) *
> > > > > > -                                 HPAGE_PMD_NR),
> > > > > > +                          nid, K(node_page_state(pgdat, NR_FILE_THPS)),
> > > > >
> > > > > Again, is this changing a user-visable value?
> > > > >
> > > >
> > > > Of course not.
> > > >
> > > > In the previous, the NR_FILE_THPS account is like below:
> > > >
> > > >     __mod_lruvec_page_state(page, NR_FILE_THPS, 1);
> > > >
> > > > With this patch, it is:
> > > >
> > > >     __mod_lruvec_page_state(page, NR_FILE_THPS, HPAGE_PMD_NR);
> > > >
> > > > So the result is not changed from the view of user space.
> > >
> > > So you "broke" it on the previous patch and "fixed" it on this one?  Why
> > > not just do it all in one patch?
> >
> > Sorry for the confusion. I mean that the "previous" is without all of this patch
> > series. So this series is aimed to convert the unit of all different THP vmstat
> > counters from HPAGE_PMD_NR to pages. Thanks.
>
> I'm sorry, I still do not understand.  It looks to me that you are
> changing the number printed to userspace here.  Where is the
> corrisponding change that changed the units for this function?  Is it in
> this patch?  If so, sorry, I did not see that at all...

Sorry, actually, this patch does not change the number printed to
userspace. It only changes the unit of the vmstat counter.

Without this patch, every counter of NR_FILE_THPS represents
NR_FILE_THPS pages. However, with this patch, every counter
represents only one page. And why do I want to do this? Can
reference to the cover letter. Thanks very much.

>
> thanks,
>
> greg k-h



-- 
Yours,
Muchun

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [External] Re: [PATCH 5/9] mm: memcontrol: convert NR_FILE_THPS account to pages
@ 2020-12-05 16:52               ` Muchun Song
  0 siblings, 0 replies; 31+ messages in thread
From: Muchun Song @ 2020-12-05 16:52 UTC (permalink / raw)
  To: Greg KH
  Cc: rafael, Alexey Dobriyan, Andrew Morton, Johannes Weiner,
	Michal Hocko, Vladimir Davydov, Hugh Dickins, Will Deacon,
	Roman Gushchin, Mike Rapoport, Thomas Gleixner, esyr, peterx,
	krisman, Suren Baghdasaryan, avagin, Marco Elver, Randy Dunlap,
	Joonsoo Kim, LKML, linux-fsdevel, Linux Memory Management List,
	Cgroups

On Sun, Dec 6, 2020 at 12:32 AM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Sat, Dec 05, 2020 at 11:39:24PM +0800, Muchun Song wrote:
> > On Sat, Dec 5, 2020 at 11:32 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> > >
> > > On Sat, Dec 05, 2020 at 11:29:26PM +0800, Muchun Song wrote:
> > > > On Sat, Dec 5, 2020 at 10:09 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> > > > >
> > > > > On Sat, Dec 05, 2020 at 09:02:20PM +0800, Muchun Song wrote:
> > > > > > Converrt NR_FILE_THPS account to pages.
> > > > > >
> > > > > > Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> > > > > > ---
> > > > > >  drivers/base/node.c | 3 +--
> > > > > >  fs/proc/meminfo.c   | 2 +-
> > > > > >  mm/filemap.c        | 2 +-
> > > > > >  mm/huge_memory.c    | 3 ++-
> > > > > >  mm/khugepaged.c     | 2 +-
> > > > > >  mm/memcontrol.c     | 5 ++---
> > > > > >  6 files changed, 8 insertions(+), 9 deletions(-)
> > > > > >
> > > > > > diff --git a/drivers/base/node.c b/drivers/base/node.c
> > > > > > index 05c369e93e16..f6a9521bbcf8 100644
> > > > > > --- a/drivers/base/node.c
> > > > > > +++ b/drivers/base/node.c
> > > > > > @@ -466,8 +466,7 @@ static ssize_t node_read_meminfo(struct device *dev,
> > > > > >                                   HPAGE_PMD_NR),
> > > > > >                            nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) *
> > > > > >                                   HPAGE_PMD_NR),
> > > > > > -                          nid, K(node_page_state(pgdat, NR_FILE_THPS) *
> > > > > > -                                 HPAGE_PMD_NR),
> > > > > > +                          nid, K(node_page_state(pgdat, NR_FILE_THPS)),
> > > > >
> > > > > Again, is this changing a user-visable value?
> > > > >
> > > >
> > > > Of course not.
> > > >
> > > > In the previous, the NR_FILE_THPS account is like below:
> > > >
> > > >     __mod_lruvec_page_state(page, NR_FILE_THPS, 1);
> > > >
> > > > With this patch, it is:
> > > >
> > > >     __mod_lruvec_page_state(page, NR_FILE_THPS, HPAGE_PMD_NR);
> > > >
> > > > So the result is not changed from the view of user space.
> > >
> > > So you "broke" it on the previous patch and "fixed" it on this one?  Why
> > > not just do it all in one patch?
> >
> > Sorry for the confusion. I mean that the "previous" is without all of this patch
> > series. So this series is aimed to convert the unit of all different THP vmstat
> > counters from HPAGE_PMD_NR to pages. Thanks.
>
> I'm sorry, I still do not understand.  It looks to me that you are
> changing the number printed to userspace here.  Where is the
> corrisponding change that changed the units for this function?  Is it in
> this patch?  If so, sorry, I did not see that at all...

Sorry, actually, this patch does not change the number printed to
userspace. It only changes the unit of the vmstat counter.

Without this patch, every counter of NR_FILE_THPS represents
NR_FILE_THPS pages. However, with this patch, every counter
represents only one page. And why do I want to do this? Can
reference to the cover letter. Thanks very much.

>
> thanks,
>
> greg k-h



-- 
Yours,
Muchun


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [External] Re: [PATCH 5/9] mm: memcontrol: convert NR_FILE_THPS account to pages
@ 2020-12-05 16:52               ` Muchun Song
  0 siblings, 0 replies; 31+ messages in thread
From: Muchun Song @ 2020-12-05 16:52 UTC (permalink / raw)
  To: Greg KH
  Cc: rafael, Alexey Dobriyan, Andrew Morton, Johannes Weiner,
	Michal Hocko, Vladimir Davydov, Hugh Dickins, Will Deacon,
	Roman Gushchin, Mike Rapoport, Thomas Gleixner, esyr, peterx,
	krisman, Suren Baghdasaryan, avagin, Marco Elver, Randy Dunlap,
	Joonsoo Kim, LKML, linux-fsdevel, Linux Memory Management List,
	Cgroups

On Sun, Dec 6, 2020 at 12:32 AM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Sat, Dec 05, 2020 at 11:39:24PM +0800, Muchun Song wrote:
> > On Sat, Dec 5, 2020 at 11:32 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> > >
> > > On Sat, Dec 05, 2020 at 11:29:26PM +0800, Muchun Song wrote:
> > > > On Sat, Dec 5, 2020 at 10:09 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> > > > >
> > > > > On Sat, Dec 05, 2020 at 09:02:20PM +0800, Muchun Song wrote:
> > > > > > Converrt NR_FILE_THPS account to pages.
> > > > > >
> > > > > > Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> > > > > > ---
> > > > > >  drivers/base/node.c | 3 +--
> > > > > >  fs/proc/meminfo.c   | 2 +-
> > > > > >  mm/filemap.c        | 2 +-
> > > > > >  mm/huge_memory.c    | 3 ++-
> > > > > >  mm/khugepaged.c     | 2 +-
> > > > > >  mm/memcontrol.c     | 5 ++---
> > > > > >  6 files changed, 8 insertions(+), 9 deletions(-)
> > > > > >
> > > > > > diff --git a/drivers/base/node.c b/drivers/base/node.c
> > > > > > index 05c369e93e16..f6a9521bbcf8 100644
> > > > > > --- a/drivers/base/node.c
> > > > > > +++ b/drivers/base/node.c
> > > > > > @@ -466,8 +466,7 @@ static ssize_t node_read_meminfo(struct device *dev,
> > > > > >                                   HPAGE_PMD_NR),
> > > > > >                            nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) *
> > > > > >                                   HPAGE_PMD_NR),
> > > > > > -                          nid, K(node_page_state(pgdat, NR_FILE_THPS) *
> > > > > > -                                 HPAGE_PMD_NR),
> > > > > > +                          nid, K(node_page_state(pgdat, NR_FILE_THPS)),
> > > > >
> > > > > Again, is this changing a user-visable value?
> > > > >
> > > >
> > > > Of course not.
> > > >
> > > > In the previous, the NR_FILE_THPS account is like below:
> > > >
> > > >     __mod_lruvec_page_state(page, NR_FILE_THPS, 1);
> > > >
> > > > With this patch, it is:
> > > >
> > > >     __mod_lruvec_page_state(page, NR_FILE_THPS, HPAGE_PMD_NR);
> > > >
> > > > So the result is not changed from the view of user space.
> > >
> > > So you "broke" it on the previous patch and "fixed" it on this one?  Why
> > > not just do it all in one patch?
> >
> > Sorry for the confusion. I mean that the "previous" is without all of this patch
> > series. So this series is aimed to convert the unit of all different THP vmstat
> > counters from HPAGE_PMD_NR to pages. Thanks.
>
> I'm sorry, I still do not understand.  It looks to me that you are
> changing the number printed to userspace here.  Where is the
> corrisponding change that changed the units for this function?  Is it in
> this patch?  If so, sorry, I did not see that at all...

Sorry, actually, this patch does not change the number printed to
userspace. It only changes the unit of the vmstat counter.

Without this patch, every counter of NR_FILE_THPS represents
NR_FILE_THPS pages. However, with this patch, every counter
represents only one page. And why do I want to do this? Can
reference to the cover letter. Thanks very much.

>
> thanks,
>
> greg k-h



-- 
Yours,
Muchun

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [External] Re: [PATCH 5/9] mm: memcontrol: convert NR_FILE_THPS account to pages
  2020-12-05 16:52               ` Muchun Song
@ 2020-12-05 17:06                 ` Greg KH
  -1 siblings, 0 replies; 31+ messages in thread
From: Greg KH @ 2020-12-05 17:06 UTC (permalink / raw)
  To: Muchun Song
  Cc: rafael, Alexey Dobriyan, Andrew Morton, Johannes Weiner,
	Michal Hocko, Vladimir Davydov, Hugh Dickins, Will Deacon,
	Roman Gushchin, Mike Rapoport, Thomas Gleixner, esyr, peterx,
	krisman, Suren Baghdasaryan, avagin, Marco Elver, Randy Dunlap,
	Joonsoo Kim, LKML, linux-fsdevel, Linux Memory Management List,
	Cgroups

On Sun, Dec 06, 2020 at 12:52:34AM +0800, Muchun Song wrote:
> On Sun, Dec 6, 2020 at 12:32 AM Greg KH <gregkh@linuxfoundation.org> wrote:
> >
> > On Sat, Dec 05, 2020 at 11:39:24PM +0800, Muchun Song wrote:
> > > On Sat, Dec 5, 2020 at 11:32 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> > > >
> > > > On Sat, Dec 05, 2020 at 11:29:26PM +0800, Muchun Song wrote:
> > > > > On Sat, Dec 5, 2020 at 10:09 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> > > > > >
> > > > > > On Sat, Dec 05, 2020 at 09:02:20PM +0800, Muchun Song wrote:
> > > > > > > Converrt NR_FILE_THPS account to pages.
> > > > > > >
> > > > > > > Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> > > > > > > ---
> > > > > > >  drivers/base/node.c | 3 +--
> > > > > > >  fs/proc/meminfo.c   | 2 +-
> > > > > > >  mm/filemap.c        | 2 +-
> > > > > > >  mm/huge_memory.c    | 3 ++-
> > > > > > >  mm/khugepaged.c     | 2 +-
> > > > > > >  mm/memcontrol.c     | 5 ++---
> > > > > > >  6 files changed, 8 insertions(+), 9 deletions(-)
> > > > > > >
> > > > > > > diff --git a/drivers/base/node.c b/drivers/base/node.c
> > > > > > > index 05c369e93e16..f6a9521bbcf8 100644
> > > > > > > --- a/drivers/base/node.c
> > > > > > > +++ b/drivers/base/node.c
> > > > > > > @@ -466,8 +466,7 @@ static ssize_t node_read_meminfo(struct device *dev,
> > > > > > >                                   HPAGE_PMD_NR),
> > > > > > >                            nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) *
> > > > > > >                                   HPAGE_PMD_NR),
> > > > > > > -                          nid, K(node_page_state(pgdat, NR_FILE_THPS) *
> > > > > > > -                                 HPAGE_PMD_NR),
> > > > > > > +                          nid, K(node_page_state(pgdat, NR_FILE_THPS)),
> > > > > >
> > > > > > Again, is this changing a user-visable value?
> > > > > >
> > > > >
> > > > > Of course not.
> > > > >
> > > > > In the previous, the NR_FILE_THPS account is like below:
> > > > >
> > > > >     __mod_lruvec_page_state(page, NR_FILE_THPS, 1);
> > > > >
> > > > > With this patch, it is:
> > > > >
> > > > >     __mod_lruvec_page_state(page, NR_FILE_THPS, HPAGE_PMD_NR);
> > > > >
> > > > > So the result is not changed from the view of user space.
> > > >
> > > > So you "broke" it on the previous patch and "fixed" it on this one?  Why
> > > > not just do it all in one patch?
> > >
> > > Sorry for the confusion. I mean that the "previous" is without all of this patch
> > > series. So this series is aimed to convert the unit of all different THP vmstat
> > > counters from HPAGE_PMD_NR to pages. Thanks.
> >
> > I'm sorry, I still do not understand.  It looks to me that you are
> > changing the number printed to userspace here.  Where is the
> > corrisponding change that changed the units for this function?  Is it in
> > this patch?  If so, sorry, I did not see that at all...
> 
> Sorry, actually, this patch does not change the number printed to
> userspace. It only changes the unit of the vmstat counter.
> 
> Without this patch, every counter of NR_FILE_THPS represents
> NR_FILE_THPS pages. However, with this patch, every counter
> represents only one page. And why do I want to do this? Can
> reference to the cover letter. Thanks very much.

Ah, I missed the change of the "ratio" value in the memory_stats[]
array.  That wasn't obvious at all, ugh.  Sorry for the noise,

greg k-h

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [External] Re: [PATCH 5/9] mm: memcontrol: convert NR_FILE_THPS account to pages
@ 2020-12-05 17:06                 ` Greg KH
  0 siblings, 0 replies; 31+ messages in thread
From: Greg KH @ 2020-12-05 17:06 UTC (permalink / raw)
  To: Muchun Song
  Cc: rafael, Alexey Dobriyan, Andrew Morton, Johannes Weiner,
	Michal Hocko, Vladimir Davydov, Hugh Dickins, Will Deacon,
	Roman Gushchin, Mike Rapoport, Thomas Gleixner, esyr, peterx,
	krisman, Suren Baghdasaryan, avagin, Marco Elver, Randy Dunlap,
	Joonsoo Kim, LKML, linux-fsdevel, Linux Memory Management List,
	Cgroups

On Sun, Dec 06, 2020 at 12:52:34AM +0800, Muchun Song wrote:
> On Sun, Dec 6, 2020 at 12:32 AM Greg KH <gregkh@linuxfoundation.org> wrote:
> >
> > On Sat, Dec 05, 2020 at 11:39:24PM +0800, Muchun Song wrote:
> > > On Sat, Dec 5, 2020 at 11:32 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> > > >
> > > > On Sat, Dec 05, 2020 at 11:29:26PM +0800, Muchun Song wrote:
> > > > > On Sat, Dec 5, 2020 at 10:09 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> > > > > >
> > > > > > On Sat, Dec 05, 2020 at 09:02:20PM +0800, Muchun Song wrote:
> > > > > > > Converrt NR_FILE_THPS account to pages.
> > > > > > >
> > > > > > > Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> > > > > > > ---
> > > > > > >  drivers/base/node.c | 3 +--
> > > > > > >  fs/proc/meminfo.c   | 2 +-
> > > > > > >  mm/filemap.c        | 2 +-
> > > > > > >  mm/huge_memory.c    | 3 ++-
> > > > > > >  mm/khugepaged.c     | 2 +-
> > > > > > >  mm/memcontrol.c     | 5 ++---
> > > > > > >  6 files changed, 8 insertions(+), 9 deletions(-)
> > > > > > >
> > > > > > > diff --git a/drivers/base/node.c b/drivers/base/node.c
> > > > > > > index 05c369e93e16..f6a9521bbcf8 100644
> > > > > > > --- a/drivers/base/node.c
> > > > > > > +++ b/drivers/base/node.c
> > > > > > > @@ -466,8 +466,7 @@ static ssize_t node_read_meminfo(struct device *dev,
> > > > > > >                                   HPAGE_PMD_NR),
> > > > > > >                            nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) *
> > > > > > >                                   HPAGE_PMD_NR),
> > > > > > > -                          nid, K(node_page_state(pgdat, NR_FILE_THPS) *
> > > > > > > -                                 HPAGE_PMD_NR),
> > > > > > > +                          nid, K(node_page_state(pgdat, NR_FILE_THPS)),
> > > > > >
> > > > > > Again, is this changing a user-visable value?
> > > > > >
> > > > >
> > > > > Of course not.
> > > > >
> > > > > In the previous, the NR_FILE_THPS account is like below:
> > > > >
> > > > >     __mod_lruvec_page_state(page, NR_FILE_THPS, 1);
> > > > >
> > > > > With this patch, it is:
> > > > >
> > > > >     __mod_lruvec_page_state(page, NR_FILE_THPS, HPAGE_PMD_NR);
> > > > >
> > > > > So the result is not changed from the view of user space.
> > > >
> > > > So you "broke" it on the previous patch and "fixed" it on this one?  Why
> > > > not just do it all in one patch?
> > >
> > > Sorry for the confusion. I mean that the "previous" is without all of this patch
> > > series. So this series is aimed to convert the unit of all different THP vmstat
> > > counters from HPAGE_PMD_NR to pages. Thanks.
> >
> > I'm sorry, I still do not understand.  It looks to me that you are
> > changing the number printed to userspace here.  Where is the
> > corrisponding change that changed the units for this function?  Is it in
> > this patch?  If so, sorry, I did not see that at all...
> 
> Sorry, actually, this patch does not change the number printed to
> userspace. It only changes the unit of the vmstat counter.
> 
> Without this patch, every counter of NR_FILE_THPS represents
> NR_FILE_THPS pages. However, with this patch, every counter
> represents only one page. And why do I want to do this? Can
> reference to the cover letter. Thanks very much.

Ah, I missed the change of the "ratio" value in the memory_stats[]
array.  That wasn't obvious at all, ugh.  Sorry for the noise,

greg k-h

^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2020-12-05 18:45 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-05 13:02 [PATCH 0/9] Convert all THP vmstat counters to pages Muchun Song
2020-12-05 13:02 ` [PATCH 1/9] mm: vmstat: fix stat_threshold for NR_KERNEL_STACK_KB Muchun Song
2020-12-05 13:02 ` [PATCH 2/9] mm: memcontrol: fix NR_ANON_THPS account Muchun Song
2020-12-05 13:02 ` [PATCH 3/9] mm: memcontrol: convert kernel stack account to byte-sized Muchun Song
2020-12-05 14:10   ` Greg KH
2020-12-05 13:02 ` [PATCH 4/9] mm: memcontrol: convert NR_ANON_THPS account to pages Muchun Song
2020-12-05 13:02   ` Muchun Song
2020-12-05 13:02 ` [PATCH 5/9] mm: memcontrol: convert NR_FILE_THPS " Muchun Song
2020-12-05 14:10   ` Greg KH
2020-12-05 14:10     ` Greg KH
2020-12-05 15:29     ` [External] " Muchun Song
2020-12-05 15:29       ` Muchun Song
2020-12-05 15:29       ` Muchun Song
2020-12-05 15:32       ` Greg KH
2020-12-05 15:32         ` Greg KH
2020-12-05 15:39         ` Muchun Song
2020-12-05 15:39           ` Muchun Song
2020-12-05 15:39           ` Muchun Song
2020-12-05 16:33           ` Greg KH
2020-12-05 16:33             ` Greg KH
2020-12-05 16:52             ` Muchun Song
2020-12-05 16:52               ` Muchun Song
2020-12-05 16:52               ` Muchun Song
2020-12-05 17:06               ` Greg KH
2020-12-05 17:06                 ` Greg KH
2020-12-05 13:02 ` [PATCH 6/9] mm: memcontrol: convert NR_SHMEM_THPS " Muchun Song
2020-12-05 13:02 ` [PATCH 7/9] mm: memcontrol: convert NR_SHMEM_PMDMAPPED " Muchun Song
2020-12-05 13:02   ` Muchun Song
2020-12-05 13:02 ` [PATCH 8/9] mm: memcontrol: convert NR_FILE_PMDMAPPED " Muchun Song
2020-12-05 13:02   ` Muchun Song
2020-12-05 13:02 ` [PATCH 9/9] mm: memcontrol: make the slab calculation consistent Muchun Song

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.