mm-list_lru-replace-linear-array-with-xarray.patch removed from -mm tree
The patch titled
Subject: mm: list_lru: replace linear array with xarray
has been removed from the -mm tree. Its filename was
mm-list_lru-replace-linear-array-with-xarray.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Muchun Song <[email protected]>
Subject: mm: list_lru: replace linear array with xarray
If we run 10k containers in the system, the size of the list_lru_memcg->lrus can be ~96KB per list_lru. When we decrease the number containers, the size of the array will not be shrinked. It is not scalable. The xarray is a good choice for this case. We can save a lot of memory when there are tens of thousands continers in the system. If we use xarray, we also can remove the logic code of resizing array, which can simplify the code.
---
include/linux/list_lru.h | 13 -- include/linux/memcontrol.h | 23 --- mm/list_lru.c | 203 +++++++++++------------------------ mm/memcontrol.c | 77 ------------- 4 files changed, 73 insertions(+), 243 deletions(-)
include/linux/list_lru.h renamed from include/linux/list_lru.h~mm-list_lru-replace-linear-array-with-xarray +2 -11
@@ -11,6 +11,7 @@#include <linux/list.h> #include <linux/nodemask.h> #include <linux/shrinker.h> +#include <linux/xarray.h> struct mem_cgroup ;
@@ -37,12 +38,6 @@ struct list_lru_per_memcg {struct list_lru_one node[]; }; -struct list_lru_memcg { -struct rcu_head rcu; -/* array of per cgroup lists, indexed by memcg_cache_id */ -struct list_lru_per_memcg __rcu *mlru[]; -}; -struct list_lru_node {/* protects all lists on the node, including per cgroup */ spinlock_t lock;
@@ -57,10 +52,7 @@ struct list_lru {struct list_head list;int shrinker_id;bool memcg_aware; -/* protects ->mlrus->mlru[i] */ -spinlock_t lock; -/* for cgroup aware lrus points to per cgroup lists, otherwise NULL */ -struct list_lru_memcg __rcu *mlrus; +struct xarray xa;#endif };
@@ -77,7 +69,6 @@ int __list_lru_init(struct list_lru *lruint memcg_list_lru_alloc (struct mem_cgroup *memcg,struct list_lru *lru,gfp_t gfp); -int memcg_update_all_list_lrus (int num_memcgs);void memcg_reparent_list_lrus (struct mem_cgroup *memcg,struct mem_cgroup *parent);/**
include/linux/memcontrol.h renamed from include/linux/memcontrol.h~mm-list_lru-replace-linear-array-with-xarray +0 -23
@@ -1685,18 +1685,6 @@ void obj_cgroup_uncharge(struct obj_cgroextern struct static_key_false memcg_kmem_enabled_key; -extern int memcg_nr_cache_ids; -void memcg_get_cache_ids (void ); -void memcg_put_cache_ids (void ); - -/* -* Helper macro to loop through all memcg-specific caches. Callers must still -* check if the cache is valid (it is either valid or NULL). -* the slab_mutex must be held when looping through those caches -*/ -#define for_each_memcg_cache_index (_idx) \ - for ((_idx) = 0; (_idx) < memcg_nr_cache_ids; (_idx)++) -static inline bool memcg_kmem_enabled (void ) {return static_branch_likely (&memcg_kmem_enabled_key);
@@ -1753,9 +1741,6 @@ static inline void __memcg_kmem_uncharge { } -#define for_each_memcg_cache_index (_idx) \ - for (; NULL; ) -static inline bool memcg_kmem_enabled (void ) {return false;
@@ -1766,14 +1751,6 @@ static inline int memcg_cache_id(structreturn -1 ; } -static inline void memcg_get_cache_ids (void ) -{ -} - -static inline void memcg_put_cache_ids (void ) -{ -} -static inline struct mem_cgroup *mem_cgroup_from_obj (void *p) {return NULL ;
mm/list_lru.c renamed from mm/list_lru.c~mm-list_lru-replace-linear-array-with-xarray +66 -137
339 lines not on this page · raw message
mm/memcontrol.c renamed from mm/memcontrol.c~mm-list_lru-replace-linear-array-with-xarray +5 -72
116 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are