Skip to content

kmemcg reparenting

Vladimir Davydov linux-mm lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v1 Latest posting 2/212 patches 8 repliesIn review
  2. v1 posting 1/212 patches 3 repliesSuperseded

Patches in v1 posting 2/2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12memcg: flush cache creation works before memcg cache destructionmm/memcontrol.c+31 -14 replies
2/12memcg: fix race in memcg cache destruction pathinclude/linux/memcontrol.h include/linux/slab.h mm/memcontrol.c +1 more+42 -694 replies
3/12memcg: fix root vs memcg cache destruction raceinclude/linux/memcontrol.h include/linux/slab.h mm/memcontrol.c +1 more+69 -330 replies
4/12memcg: move slab caches list/mutex init to memcg creationmm/memcontrol.c+3 -20 replies
5/12memcg: add pointer from memcg_cache_params to cacheinclude/linux/slab.h mm/memcontrol.c+5 -250 replies
6/12memcg: keep all children of each root cache on a listinclude/linux/memcontrol.h include/linux/slab.h mm/memcontrol.c +3 more+79 -600 replies
7/12memcg: rework slab charginginclude/linux/memcontrol.h mm/memcontrol.c mm/slab.c +2 more+72 -290 replies
8/12memcg: do not charge kmalloc_large allocationsinclude/linux/slab.h mm/slub.c+3 -30 replies
9/12fork: do not charge thread_info to kmemcginclude/linux/thread_info.h kernel/fork.c+2 -40 replies
10/12memcg: kill GFP_KMEMCG and stuffinclude/linux/gfp.h include/linux/memcontrol.h include/trace/events/gfpflags.h +2 more+0 -2480 replies
11/12memcg: reparent slab on css offlinemm/memcontrol.c+189 -1170 replies
12/12slub: make sure all memcg caches have unique names on sysfsmm/slub.c+12 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH RESEND -mm 00/12] kmemcg reparenting

[rebased on top of v3.14-rc6-mmotm-2014-03-12-16-04]

Hi,

During my recent attempt to push kmemcg shrinkers, I was pointed out that current kmemcg implementation has a serious design flaw - it lacks reparenting. Currently each memcg cache holds a css ref to its memcg and does not let it go until the cache is emptied. Although this approach is simple, it leads to memcgs hanging around for quite a long time after the death, which is ugly. Building something on top of that is unacceptable. So this patch set targets on implementing reparenting for kmemcg charges.

[ for more details see the discussion thread:
https://lkml.org/lkml/2014/2/11/623 ]

It is based on top of 3.14-rc6-mmotm and organized as follows:
- Patches 1-3 fix some nasty races in kmemcg implementation. I could not let them live any longer, because they touch the code I'm going to modify.
- Patches 4-6 prepare memcg_cache_params for reparenting.
- Patch 7 rework slab charging making it easier to track and therefore reparent kmem charges, and patches 8-10 kill the old charging code.
- Patch 11 introduces kmemcg reparenting.
- Patch 12 is for slub. It fixes sysfs naming clashes that can arise due to reparented caches.

Please note that this patch set does not resolve all kmemcg-related issues - there are still plenty of them (e.g. "dangling" caches), but it is already big enough so I guess I'll address them later when this one is committed (if it will be committed at all, of course).

Many thanks to Johannes Weiner, who proposed the idea and kindly outlined basic design principles.

Thanks,

Vladimir Davydov (12):
memcg: flush cache creation works before memcg cache destruction
memcg: fix race in memcg cache destruction path
memcg: fix root vs memcg cache destruction race
memcg: move slab caches list/mutex init to memcg creation
memcg: add pointer from memcg_cache_params to cache
memcg: keep all children of each root cache on a list
memcg: rework slab charging
memcg: do not charge kmalloc_large allocations
fork: do not charge thread_info to kmemcg
memcg: kill GFP_KMEMCG and stuff
memcg: reparent slab on css offline
slub: make sure all memcg caches have unique names on sysfs

 include/linux/gfp.h             |    5 -
 include/linux/memcontrol.h      |  133 ++-------
 include/linux/slab.h            |   15 +-
 include/linux/thread_info.h     |    2 -
 include/trace/events/gfpflags.h |    1 -
 kernel/fork.c                   |    4 +-
 mm/memcontrol.c                 |  579 +++++++++++++++++----------------------
 mm/page_alloc.c                 |   35 ---
 mm/slab.c                       |   47 ++--
 mm/slab.h                       |   17 +-
 mm/slab_common.c                |  100 +++++--
 mm/slub.c                       |   85 ++++--
 12 files changed, 469 insertions(+), 554 deletions(-)
Signature · 7 lines
1.7.10.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>