* [to-be-updated] mm-memcontrol-make-the-slab-calculation-consistent.patch removed from -mm tree
@ 2020-12-05 0:49 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2020-12-05 0:49 UTC (permalink / raw)
To: guro, hannes, mhocko, mm-commits, songmuchun, vdavydov.dev
The patch titled
Subject: mm/memcontrol: make the slab calculation consistent
has been removed from the -mm tree. Its filename was
mm-memcontrol-make-the-slab-calculation-consistent.patch
This patch was dropped because an updated version will be merged
------------------------------------------------------
From: Muchun Song <songmuchun@bytedance.com>
Subject: mm/memcontrol: make the slab calculation consistent
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. Simplify the code here.
Link: https://lkml.kernel.org/r/20201203031111.3187-1-songmuchun@bytedance.com
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Acked-by: Roman Gushchin <guro@fb.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/memcontrol.c | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
--- a/mm/memcontrol.c~mm-memcontrol-make-the-slab-calculation-consistent
+++ a/mm/memcontrol.c
@@ -1612,12 +1612,22 @@ static int __init memory_stats_init(void
int i;
for (i = 0; i < ARRAY_SIZE(memory_stats); i++) {
+ switch (memory_stats[i].idx) {
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
- if (memory_stats[i].idx == NR_ANON_THPS ||
- memory_stats[i].idx == NR_FILE_THPS ||
- memory_stats[i].idx == NR_SHMEM_THPS)
+ case NR_ANON_THPS:
+ case NR_FILE_THPS:
+ case NR_SHMEM_THPS:
memory_stats[i].ratio = HPAGE_PMD_SIZE;
+ break;
#endif
+ case NR_SLAB_UNRECLAIMABLE_B:
+ VM_BUG_ON(i < 1);
+ VM_BUG_ON(memory_stats[i - 1].idx != NR_SLAB_RECLAIMABLE_B);
+ break;
+ default:
+ break;
+ }
+
VM_BUG_ON(!memory_stats[i].ratio);
VM_BUG_ON(memory_stats[i].idx >= MEMCG_NR_STAT);
}
@@ -1653,9 +1663,15 @@ static char *memory_stat_format(struct m
size *= memory_stats[i].ratio;
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);
+ int idx = i - 1;
+
+ size += memcg_page_state(memcg, memory_stats[idx].idx) *
+ memory_stats[idx].ratio;
seq_buf_printf(&s, "slab %llu\n", size);
}
}
_
Patches currently in -mm which might be from songmuchun@bytedance.com are
mm-memcontrol-remove-unused-mod_memcg_obj_state.patch
mm-memcg-slab-fix-return-child-memcg-objcg-for-root-memcg.patch
mm-memcg-slab-fix-use-after-free-in-obj_cgroup_charge.patch
mm-memcg-slab-rename-_lruvec_slab_state-to-_lruvec_kmem_state.patch
mm-page_alloc-speeding-up-the-iteration-of-max_order.patch
mm-page_isolation-do-not-isolate-the-max-order-page.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-12-05 0:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-05 0:49 [to-be-updated] mm-memcontrol-make-the-slab-calculation-consistent.patch removed from -mm tree akpm
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.