]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
slub-slub-specific-propagation-changes-fix
authorAndrew Morton <akpm@linux-foundation.org>
Fri, 9 Nov 2012 03:04:19 +0000 (14:04 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 13 Nov 2012 05:15:30 +0000 (16:15 +1100)
tweak code to avoid __maybe_unused

Cc: Christoph Lameter <cl@linux.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Frederic Weisbecker <fweisbec@redhat.com>
Cc: Glauber Costa <glommer@parallels.com>
Cc: Greg Thelen <gthelen@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: JoonSoo Kim <js1304@gmail.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Rik van Riel <riel@redhat.com>
Cc: Suleiman Souhlal <suleiman@google.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/slub.c

index 4cca656bfa1be940900046fc571cdd1c5e12f046..9cdb6f1adc432375860ca9fa2f76a4c6cafea667 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -5175,7 +5175,6 @@ static ssize_t slab_attr_store(struct kobject *kobj,
        struct slab_attribute *attribute;
        struct kmem_cache *s;
        int err;
-       int i __maybe_unused;
 
        attribute = to_slab_attr(attr);
        s = to_slab(kobj);
@@ -5185,23 +5184,24 @@ static ssize_t slab_attr_store(struct kobject *kobj,
 
        err = attribute->store(s, buf, len);
 #ifdef CONFIG_MEMCG_KMEM
-       if (slab_state < FULL)
-               return err;
+       if (slab_state >= FULL && err >= 0 && is_root_cache(s)) {
+               int i;
 
-       if ((err < 0) || !is_root_cache(s))
-               return err;
+               mutex_lock(&slab_mutex);
+               if (s->max_attr_size < len)
+                       s->max_attr_size = len;
 
-       mutex_lock(&slab_mutex);
-       if (s->max_attr_size < len)
-               s->max_attr_size = len;
-
-       for_each_memcg_cache_index(i) {
-               struct kmem_cache *c = cache_from_memcg(s, i);
-               if (c)
-                       /* return value determined by the parent cache only */
-                       attribute->store(c, buf, len);
+               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);
+               }
+               mutex_unlock(&slab_mutex);
        }
-       mutex_unlock(&slab_mutex);
 #endif
        return err;
 }