Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1653463 > unrolled thread

[PATCH 0/6] mm: per-lruvec slab stats

Started byJohannes Weiner <hannes@cmpxchg.org>
First post2017-05-30 20:20 +0200
Last post2017-06-03 19:40 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/6] mm: per-lruvec slab stats Johannes Weiner <hannes@cmpxchg.org> - 2017-05-30 20:20 +0200
    [PATCH 3/6] mm: memcontrol: use the node-native slab memory counters Johannes Weiner <hannes@cmpxchg.org> - 2017-05-30 20:20 +0200
      Re: [PATCH 3/6] mm: memcontrol: use the node-native slab memory  counters Vladimir Davydov <vdavydov.dev@gmail.com> - 2017-06-03 19:40 +0200

#1653463 — [PATCH 0/6] mm: per-lruvec slab stats

FromJohannes Weiner <hannes@cmpxchg.org>
Date2017-05-30 20:20 +0200
Subject[PATCH 0/6] mm: per-lruvec slab stats
Message-ID<tMTUl-2jI-5@gated-at.bofh.it>
Hi everyone,

Josef is working on a new approach to balancing slab caches and the
page cache. For this to work, he needs slab cache statistics on the
lruvec level. These patches implement that by adding infrastructure
that allows updating and reading generic VM stat items per lruvec,
then switches some existing VM accounting sites, including the slab
accounting ones, to this new cgroup-aware API.

I'll follow up with more patches on this, because there is actually
substantial simplification that can be done to the memory controller
when we replace private memcg accounting with making the existing VM
accounting sites cgroup-aware. But this is enough for Josef to base
his slab reclaim work on, so here goes.

 drivers/base/node.c        |  10 +-
 include/linux/memcontrol.h | 257 ++++++++++++++++++++++++++++++++++++---------
 include/linux/mmzone.h     |   4 +-
 include/linux/swap.h       |   1 -
 include/linux/vmstat.h     |   1 -
 kernel/fork.c              |   8 +-
 mm/memcontrol.c            |  14 ++-
 mm/page-writeback.c        |  15 +--
 mm/page_alloc.c            |   4 -
 mm/rmap.c                  |   8 +-
 mm/slab.c                  |  12 +--
 mm/slab.h                  |  18 +---
 mm/slub.c                  |   4 +-
 mm/vmscan.c                |  18 +---
 mm/vmstat.c                |   4 +-
 mm/workingset.c            |   9 +-
 16 files changed, 250 insertions(+), 137 deletions(-)

[toc] | [next] | [standalone]


#1653467 — [PATCH 3/6] mm: memcontrol: use the node-native slab memory counters

FromJohannes Weiner <hannes@cmpxchg.org>
Date2017-05-30 20:20 +0200
Subject[PATCH 3/6] mm: memcontrol: use the node-native slab memory counters
Message-ID<tMTUm-2jI-33@gated-at.bofh.it>
In reply to#1653463
Now that the slab counters are moved from the zone to the node level
we can drop the private memcg node stats and use the official ones.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
 include/linux/memcontrol.h | 2 --
 mm/memcontrol.c            | 8 ++++----
 mm/slab.h                  | 4 ++--
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 899949bbb2f9..7b8f0f239fd6 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -44,8 +44,6 @@ enum memcg_stat_item {
 	MEMCG_SOCK,
 	/* XXX: why are these zone and not node counters? */
 	MEMCG_KERNEL_STACK_KB,
-	MEMCG_SLAB_RECLAIMABLE,
-	MEMCG_SLAB_UNRECLAIMABLE,
 	MEMCG_NR_STAT,
 };
 
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 94172089f52f..9c68a40c83e3 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5197,8 +5197,8 @@ static int memory_stat_show(struct seq_file *m, void *v)
 	seq_printf(m, "kernel_stack %llu\n",
 		   (u64)stat[MEMCG_KERNEL_STACK_KB] * 1024);
 	seq_printf(m, "slab %llu\n",
-		   (u64)(stat[MEMCG_SLAB_RECLAIMABLE] +
-			 stat[MEMCG_SLAB_UNRECLAIMABLE]) * PAGE_SIZE);
+		   (u64)(stat[NR_SLAB_RECLAIMABLE] +
+			 stat[NR_SLAB_UNRECLAIMABLE]) * PAGE_SIZE);
 	seq_printf(m, "sock %llu\n",
 		   (u64)stat[MEMCG_SOCK] * PAGE_SIZE);
 
@@ -5222,9 +5222,9 @@ static int memory_stat_show(struct seq_file *m, void *v)
 	}
 
 	seq_printf(m, "slab_reclaimable %llu\n",
-		   (u64)stat[MEMCG_SLAB_RECLAIMABLE] * PAGE_SIZE);
+		   (u64)stat[NR_SLAB_RECLAIMABLE] * PAGE_SIZE);
 	seq_printf(m, "slab_unreclaimable %llu\n",
-		   (u64)stat[MEMCG_SLAB_UNRECLAIMABLE] * PAGE_SIZE);
+		   (u64)stat[NR_SLAB_UNRECLAIMABLE] * PAGE_SIZE);
 
 	/* Accumulated memory events */
 
diff --git a/mm/slab.h b/mm/slab.h
index 9cfcf099709c..69f0579cb5aa 100644
--- a/mm/slab.h
+++ b/mm/slab.h
@@ -287,7 +287,7 @@ static __always_inline int memcg_charge_slab(struct page *page,
 
 	memcg_kmem_update_page_stat(page,
 			(s->flags & SLAB_RECLAIM_ACCOUNT) ?
-			MEMCG_SLAB_RECLAIMABLE : MEMCG_SLAB_UNRECLAIMABLE,
+			NR_SLAB_RECLAIMABLE : NR_SLAB_UNRECLAIMABLE,
 			1 << order);
 	return 0;
 }
@@ -300,7 +300,7 @@ static __always_inline void memcg_uncharge_slab(struct page *page, int order,
 
 	memcg_kmem_update_page_stat(page,
 			(s->flags & SLAB_RECLAIM_ACCOUNT) ?
-			MEMCG_SLAB_RECLAIMABLE : MEMCG_SLAB_UNRECLAIMABLE,
+			NR_SLAB_RECLAIMABLE : NR_SLAB_UNRECLAIMABLE,
 			-(1 << order));
 	memcg_kmem_uncharge(page, order);
 }
-- 
2.12.2

[toc] | [prev] | [next] | [standalone]


#1656871 — Re: [PATCH 3/6] mm: memcontrol: use the node-native slab memory counters

FromVladimir Davydov <vdavydov.dev@gmail.com>
Date2017-06-03 19:40 +0200
SubjectRe: [PATCH 3/6] mm: memcontrol: use the node-native slab memory counters
Message-ID<tOlbP-1u4-7@gated-at.bofh.it>
In reply to#1653467
On Tue, May 30, 2017 at 02:17:21PM -0400, Johannes Weiner wrote:
> Now that the slab counters are moved from the zone to the node level
> we can drop the private memcg node stats and use the official ones.
> 
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> ---
>  include/linux/memcontrol.h | 2 --
>  mm/memcontrol.c            | 8 ++++----
>  mm/slab.h                  | 4 ++--
>  3 files changed, 6 insertions(+), 8 deletions(-)

Not sure if moving slab stats from zone to node is such a good idea,
because they may be useful for identifying the reason of OOM, especially
on 32 bit hosts, but provided the previous patch is accepted, this one
looks good to me.

Acked-by: Vladimir Davydov <vdavydov.dev@gmail.com>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web