Skip to content

kmemcg shrinkers

Glauber Costa cgroups linux-fsdevel linux-mm 3 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v10 Latest16 patches 0 repliesNew
  2. v22 patches 2 repliesSuperseded
  3. v11 patch 5 repliesSuperseded

Patches in v10 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/16memcg: make cache index determination more robustmm/memcontrol.c+3 -10 replies
2/16memcg: consolidate callers of memcg_cache_idmm/memcontrol.c+29 -200 replies
3/16vmscan: also shrink slab in memcg pressureinclude/linux/memcontrol.h include/linux/shrinker.h mm/memcontrol.c +1 more+83 -70 replies
4/16memcg: move stop and resume accounting functionsmm/memcontrol.c+32 -310 replies
5/16memcg,list_lru: duplicate LRUs upon kmemcg creationinclude/linux/list_lru.h include/linux/memcontrol.h mm/list_lru.c +2 more+323 -160 replies
6/16lru: add an element to a memcg listinclude/linux/list_lru.h include/linux/memcontrol.h mm/list_lru.c +1 more+146 -100 replies
7/16list_lru: per-memcg walksinclude/linux/list_lru.h include/linux/memcontrol.h mm/list_lru.c+45 -120 replies
8/16memcg: move initialization to memcg creationmm/memcontrol.c+2 -30 replies
9/16memcg: per-memcg kmem shrinkinginclude/linux/swap.h mm/memcontrol.c mm/vmscan.c+155 -70 replies
10/16memcg: scan cache objects hierarchicallyinclude/linux/memcontrol.h mm/memcontrol.c mm/vmscan.c+73 -110 replies
11/16vmscan: take at least one pass with shrinkersmm/vmscan.c+18 -50 replies
12/16super: targeted memcg reclaimfs/dcache.c fs/inode.c fs/internal.h +1 more+33 -210 replies
13/16memcg: allow kmem limit to be resized downmm/memcontrol.c+38 -50 replies
14/16vmpressure: in-kernel notificationsinclude/linux/vmpressure.h mm/vmpressure.c+55 -30 replies
15/16memcg: reap dead memcgs upon global memory pressuremm/memcontrol.c+78 -30 replies
16/16memcg: flush memcg items upon memcg destructionmm/memcontrol.c+17 -00 replies

Reviews trailers per patch

1 of 16 patches has a Reviewed-by or Acked-by.

PatchAnton VorontsovPekka EnbergGreg Thelen
1/16
2/16
3/16
4/16
5/16
6/16
7/16
8/16
9/16
10/16
11/16
12/16
13/16
14/16A-b A-b R-b
15/16
16/16

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v10 thread

Cover letter [PATCH v10 00/16] kmemcg shrinkers

Now that the list_lru seems to have stabilized, I am sending this out for review again. This now contains only the memcg part of the patchset, rebased on top of today's linux-next. Comments appreciated.

This patchset implements targeted shrinking for memcg when kmem limits are present. So far, we've been accounting kernel objects but failing allocations when short of memory. This is because our only option would be to call the global shrinker, depleting objects from all caches and breaking isolation.

The main idea is to associate per-memcg lists with each of the LRUs. The main LRU still provides a single entry point and when adding or removing an element from the LRU, we use the page information to figure out which memcg it belongs to and relay it to the right list.

Main changes from *v9
* Fixed iteration over all memcgs from list_lru side.

Main changes from *v8
* fixed xfs umount bug
* rebase to current linux-next

Main changes from *v7:
* Fixed races for memcg
* Enhanced memcg hierarchy walks during global pressure (we were walking only the global list, not all memcgs)

Main changes from *v6:
* Change nr_unused_dentry to long, Dave reported an int not being enough
* Fixed shrink_list leak, by Dave
* LRU API now gets a node id, instead of a node mask.
* per-node deferred work, leading to smoother behavior

Main changes from *v5:
* Rebased to linux-next, and fix the conflicts with the dcache.
* Make sure LRU_RETRY only retry once
* Prevent the bcache shrinker to scan the caches when disabled (by returning 0 in the count function)
* Fix i915 return code when mutex cannot be acquired.
* Only scan less-than-batch objects in memcg scenarios

Main changes from *v4:
* Fixed a bug in user-generated memcg pressure
* Fixed overly-agressive slab shrinker behavior spotted by Mel Gorman
* Various other fixes and comments by Mel Gorman

Main changes from *v3:
* Merged suggestions from mailing list.
* Removed the memcg-walking code from LRU. vmscan now drives all the hierarchy decisions, which makes more sense
* lazily free the old memcg arrays (needs now to be saved in struct lru). Since we need to call synchronize_rcu, calling it for every LRU can become expensive
* Moved the dead memcg shrinker to vmpressure. Already independently sent to linux-mm for review.
* Changed locking convention for LRU_RETRY. It now needs to return locked, which silents warnings about possible lock unbalance (although previous code was correct)

Main changes from *v2:
* shrink dead memcgs when global pressure kicks in. Uses the new lru API.
* bugfixes and comments from the mailing list.
* proper hierarchy-aware walk in shrink_slab.

Main changes from *v1:
* merged comments from the mailing list
* reworked lru-memcg API
* effective proportional shrinking
* sanitized locking on the memcg side
* bill user memory first when kmem == umem
* various bugfixes

*** BLURB HERE ***

Glauber Costa (16):
memcg: make cache index determination more robust
memcg: consolidate callers of memcg_cache_id
vmscan: also shrink slab in memcg pressure
memcg: move stop and resume accounting functions memcg,list_lru: duplicate LRUs upon kmemcg creation
lru: add an element to a memcg list
list_lru: per-memcg walks
memcg: move initialization to memcg creation
memcg: per-memcg kmem shrinking
memcg: scan cache objects hierarchically
vmscan: take at least one pass with shrinkers
super: targeted memcg reclaim
memcg: allow kmem limit to be resized down
vmpressure: in-kernel notifications
memcg: reap dead memcgs upon global memory pressure
memcg: flush memcg items upon memcg destruction

 fs/dcache.c                |   7 +-
 fs/inode.c                 |   7 +-
 fs/internal.h              |   5 +-
 fs/super.c                 |  35 ++-
 include/linux/list_lru.h   |  94 +++++++-
 include/linux/memcontrol.h |  43 ++++
 include/linux/shrinker.h   |   6 +-
 include/linux/swap.h       |   2 +
 include/linux/vmpressure.h |   6 +
 mm/list_lru.c              | 246 +++++++++++++++++--
 mm/memcontrol.c            | 574 +++++++++++++++++++++++++++++++++++++++------
 mm/slab_common.c           |   1 -
 mm/vmpressure.c            |  52 +++-
 mm/vmscan.c                | 179 ++++++++++++--
 14 files changed, 1116 insertions(+), 141 deletions(-)
Signature · 7 lines
1.8.2.1

--
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>