Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 347031
b: refs/heads/master
c: ebe945c
h: refs/heads/master
i:
  347029: 828771a
  347027: 8b37aed
  347023: e4e9568
v: v3
  • Loading branch information
Glauber Costa authored and Linus Torvalds committed Dec 18, 2012
1 parent 24d38a4 commit aa1d193
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 92e793495597af4135d94314113bf13eafb0e663
refs/heads/master: ebe945c27628fca03723582eba138acc2e2f3d15
6 changes: 6 additions & 0 deletions trunk/include/linux/memcontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,12 @@ static inline void sock_release_memcg(struct sock *sk)
extern struct static_key memcg_kmem_enabled_key;

extern int memcg_limited_groups_array_size;

/*
* 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; i < memcg_limited_groups_array_size; (_idx)++)

Expand Down
1 change: 1 addition & 0 deletions trunk/mm/slab.c
Original file line number Diff line number Diff line change
Expand Up @@ -4099,6 +4099,7 @@ static int do_tune_cpucache(struct kmem_cache *cachep, int limit,
if ((ret < 0) || !is_root_cache(cachep))
return ret;

VM_BUG_ON(!mutex_is_locked(&slab_mutex));
for_each_memcg_cache_index(i) {
c = cache_from_memcg(cachep, i);
if (c)
Expand Down
21 changes: 17 additions & 4 deletions trunk/mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -5108,12 +5108,25 @@ static ssize_t slab_attr_store(struct kobject *kobj,
if (s->max_attr_size < len)
s->max_attr_size = len;

/*
* This is a best effort propagation, so this function's return
* value will be determined by the parent cache only. This is
* basically because not all attributes will have a well
* defined semantics for rollbacks - most of the actions will
* have permanent effects.
*
* Returning the error value of any of the children that fail
* is not 100 % defined, in the sense that users seeing the
* error code won't be able to know anything about the state of
* the cache.
*
* Only returning the error code for the parent cache at least
* has well defined semantics. The cache being written to
* directly either failed or succeeded, in which case we loop
* through the descendants with best-effort propagation.
*/
for_each_memcg_cache_index(i) {
struct kmem_cache *c = cache_from_memcg(s, i);
/*
* This function's return value is determined by the
* parent cache only
*/
if (c)
attribute->store(c, buf, len);
}
Expand Down

0 comments on commit aa1d193

Please sign in to comment.