lru-add-an-element-to-a-memcg-list.patch removed from -mm tree
Subsystems (4)
[email protected]
maintainerSubject: [to-be-updated] lru-add-an-element-to-a-memcg-list.patch removed from -mm tree
To: [email protected],[email protected],[email protected]
From: [email protected]
Date: Thu, 06 Jun 2013 12:35:13 -0700
The patch titled
Subject: lru: add an element to a memcg list
has been removed from the -mm tree. Its filename was
lru-add-an-element-to-a-memcg-list.patch
This patch was dropped because an updated version will be merged
------------------------------------------------------
From: Glauber Costa <[email protected]>
Subject: lru: add an element to a memcg list
With the infrastructure we now have, we can add an element to a memcg LRU list instead of the global list. The memcg lists are still per-node.
Technically, we will never trigger per-node shrinking in the memcg is short of memory. Therefore an alternative to this would be to add the element to *both* a single-node memcg array and a per-node global array.
There are two main reasons for this design choice:
1) adding an extra list_head to each of the objects would waste 16-bytes per object, always remembering that we are talking about 1 dentry + 1 inode in the common case. This means a close to 10 % increase in the dentry size, and a lower yet significant increase in the inode size. In terms of total memory, this design pays 32-byte per-superblock-per-node (size of struct list_lru_node), which means that in any scenario where we have more than 10 dentries + inodes, we would already be paying more memory in the two-list-heads approach than we will here with 1 node x 10 superblocks. The turning point of course depends on the workload, but I hope the figures above would convince you that the memory footprint is in my side in any workload that matters.
2) The main drawback of this, namely, that we loose global LRU order, is not really seen by me as a disadvantage: if we are using memcg to isolate the workloads, global pressure should try to balance the amount reclaimed from all memcgs the same way the shrinkers will already naturally balance the amount reclaimed from each superblock. (This patchset needs some love in this regard, btw).
To help us easily tracking down which nodes have and which nodes doesn't have elements in the list, we will count on an auxiliary node bitmap in the global level.
---
include/linux/list_lru.h | 11 +++ include/linux/memcontrol.h | 8 ++ lib/list_lru.c | 112 ++++++++++++++++++++++++++++++++--- mm/memcontrol.c | 43 ++++++++++--- 4 files changed, 156 insertions(+), 18 deletions(-)
include/linux/list_lru.h renamed from include/linux/list_lru.h~lru-add-an-element-to-a-memcg-list +11 -0
@@ -53,12 +53,23 @@ struct list_lru {* structure, we may very well fail. */ struct list_lru_node node[MAX_NUMNODES ]; +atomic_long_t node_totals[MAX_NUMNODES ];nodemask_t active_nodes;#ifdef CONFIG_MEMCG_KMEM /* All memcg-aware LRUs will be chained in the lrus list */ struct list_head lrus;/* M x N matrix as described above */ struct list_lru_array **memcg_lrus; +/* +* The memcg_lrus is RCU protected, so we need to keep the previous +* array around when we update it. But we can only do that after +* synchronize_rcu(). A typical system has many LRUs, which means +* that if we call synchronize_rcu after each LRU update, this +* will become very expensive. We add this pointer here, and then +* after all LRUs are update, we call synchronize_rcu() once, and +* free all the old_arrays. +*/ +void *old_array;#endif };
include/linux/memcontrol.h renamed from include/linux/memcontrol.h~lru-add-an-element-to-a-memcg-list +8 -0
@@ -24,6 +24,7 @@#include <linux/hardirq.h> #include <linux/jump_label.h> #include <linux/list_lru.h> +#include <linux/mm.h> struct mem_cgroup ;struct page_cgroup ;
@@ -474,6 +475,8 @@ __memcg_kmem_get_cache(struct kmem_cacheint memcg_new_lru (struct list_lru *lru);int memcg_init_lru (struct list_lru *lru); +struct mem_cgroup *mem_cgroup_from_kmem_page (struct page *page); +int memcg_kmem_update_lru_size (struct list_lru *lru,int num_groups,bool new_lru);
@@ -645,6 +648,11 @@ static inline int memcg_init_lru(struct {return 0 ; } + +static inline struct mem_cgroup *mem_cgroup_from_kmem_page (struct page *page) +{ +return NULL ; +}#endif /* CONFIG_MEMCG_KMEM */ #endif /* _LINUX_MEMCONTROL_H */
lib/list_lru.c renamed from lib/list_lru.c~lru-add-an-element-to-a-memcg-list +103 -9
159 lines not on this page · raw message
mm/memcontrol.c renamed from mm/memcontrol.c~lru-add-an-element-to-a-memcg-list +34 -9
75 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are
list_lru-per-memcg-walks.patch memcg-per-memcg-kmem-shrinking.patch memcg-scan-cache-objects-hierarchically.patch vmscan-take-at-least-one-pass-with-shrinkers.patch super-targeted-memcg-reclaim.patch memcg-move-initialization-to-memcg-creation.patch vmpressure-in-kernel-notifications.patch memcg-reap-dead-memcgs-upon-global-memory-pressure.patch