Skip to content

cleanup kmemcg charging (was: "kmemcg: get rid of __GFP_KMEMCG")

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. v2 Latest2 patches 3 repliesIn review
  2. v14 patches 14 repliesSuperseded

Changes in v2 from the cover letter

- use static key optimization in memcg_(un)charge_slab to avoid any overhead if kmemcg is not used;
- introduce helper functions, alloc/free_kmem_pages, which charge newly allocated pages to kmemcg, to avoid code duplication;
- do not remove accounting of kmalloc_large allocations (as discussed in the comments to v1).

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2sl[au]b: charge slabs to kmemcg explicitlyinclude/linux/memcontrol.h mm/memcontrol.c mm/slab.c +3 more+59 -261 reply
2/2mm: get rid of __GFP_KMEMCGinclude/linux/gfp.h include/linux/memcontrol.h include/linux/slab.h +6 more+60 -4612 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchGreg Thelen
1/2A-b
2/2A-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH -mm v2 0/2] cleanup kmemcg charging (was: "kmemcg: get rid of __GFP_KMEMCG")

Hi,

Currently we charge kmem to memcg in alloc_pages if __GFP_KMEMCG is passed. However, since there are only a few places where we actually want to charge kmem, we could call kmemcg charge function explicitly instead. That would remove all kmemcg-related stuff from the general allocation path and make all kmem charges easier to follow.

So let's charge kmem explicitly where we want it to be charged (slab, threadinfo) and remove __GFP_KMEMCG.

Changes in v2:
- use static key optimization in memcg_(un)charge_slab to avoid any overhead if kmemcg is not used;
- introduce helper functions, alloc/free_kmem_pages, which charge newly allocated pages to kmemcg, to avoid code duplication;
- do not remove accounting of kmalloc_large allocations (as discussed in the comments to v1).

v1 can be found at lkml.org/lkml/2014/3/26/228

Thanks,

Vladimir Davydov (2):
sl[au]b: charge slabs to kmemcg explicitly
mm: get rid of __GFP_KMEMCG

 include/linux/gfp.h             |   10 ++++---
 include/linux/memcontrol.h      |   17 ++++--------
 include/linux/slab.h            |   11 --------
 include/linux/thread_info.h     |    2 --
 include/trace/events/gfpflags.h |    1 -
 kernel/fork.c                   |    6 ++---
 mm/memcontrol.c                 |    4 +--
 mm/page_alloc.c                 |   56 ++++++++++++++++++++++++---------------
 mm/slab.c                       |    7 ++++-
 mm/slab.h                       |   29 ++++++++++++++++++++
 mm/slab_common.c                |   18 +++++++++----
 mm/slub.c                       |   30 ++++++++++++++-------
 12 files changed, 119 insertions(+), 72 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>