Skip to contentSkip to conversation

fixup: mm: memcontrol: Unbreak memcontrol build when THP is disabled

PATCH New Chris Down 1 participant 1 message Jan 31, 2019

Subsystems (4)
lore
Share & tools
lore

Chris Down

author
#0 lore raw

PATCH 1/1 fixup: mm: memcontrol: Unbreak memcontrol build when THP is disabled

This can be folded into "mm: memcontrol: Expose THP events on a per-memcg basis" (mm-memcontrol-expose-thp-events-on-a-per-memcg-basis.patch).

kbuild points out that this patch can't be built with CONFIG_TRANSPARENT_HUGEPAGE not set. I had originally worried about this, but had only checked NR_ANON_THPS (which is not ifdeffed), not the event counters.

NR_ANON_THPS is not #ifdeffed in node_stat_item, so we don't need to also guard MEMCG_RSS_HUGE to futureproof it.

---
 Documentation/admin-guide/cgroup-v2.rst | 8 +++++---
 mm/memcontrol.c                         | 2 ++
 2 files changed, 7 insertions(+), 3 deletions(-)
Documentation/admin-guide/cgroup-v2.rst +5 -3
index b6989b39ed8e..53d3288c328b 100644
@@ -1255,12 +1255,14 @@ PAGE_SIZE multiple when read back.
 	  thp_fault_alloc
 
 		Number of transparent hugepages which were allocated to satisfy
-		a page fault, including COW faults
+		a page fault, including COW faults. This counter is not present
+		when CONFIG_TRANSPARENT_HUGEPAGE is not set.
 
 	  thp_collapse_alloc
 
-		Number of transparent hugepages which were allocated to
-		allow collapsing an existing range of pages
+		Number of transparent hugepages which were allocated to allow
+		collapsing an existing range of pages. This counter is not
+		present when CONFIG_TRANSPARENT_HUGEPAGE is not set.
 
   memory.swap.current
 	A read-only single value file which exists on non-root
mm/memcontrol.c +2 -0
index 2f4fe2fb9046..bc4da016b8ce 100644
@@ -5643,9 +5643,11 @@ static int memory_stat_show(struct seq_file *m, void *v)
 	seq_printf(m, "pglazyfree %lu\n", acc.events[PGLAZYFREE]);
 	seq_printf(m, "pglazyfreed %lu\n", acc.events[PGLAZYFREED]);
 
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
 	seq_printf(m, "thp_fault_alloc %lu\n", acc.events[THP_FAULT_ALLOC]);
 	seq_printf(m, "thp_collapse_alloc %lu\n",
 		   acc.events[THP_COLLAPSE_ALLOC]);
+#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
 
 	return 0;
 }
Signature · 1 line
2.20.1