Merge branch 'slab/urgent' into slab/next
authorPekka Enberg <penberg@kernel.org>
Fri, 11 Mar 2011 16:11:19 +0000 (18:11 +0200)
committerPekka Enberg <penberg@kernel.org>
Fri, 11 Mar 2011 16:11:19 +0000 (18:11 +0200)
1  2 
mm/slab.c

diff --combined mm/slab.c
index 7d92f08b88d7ff7f583d5da8936529076a334acf,4c6e2e31ced05ce6aab5b5ae2ab5f0a88dd00054..a18ba57517af469eac32ef7c572327c6bed7668a
+++ b/mm/slab.c
@@@ -190,6 -190,22 +190,6 @@@ typedef unsigned int kmem_bufctl_t
  #define       BUFCTL_ACTIVE   (((kmem_bufctl_t)(~0U))-2)
  #define       SLAB_LIMIT      (((kmem_bufctl_t)(~0U))-3)
  
 -/*
 - * struct slab
 - *
 - * Manages the objs in a slab. Placed either at the beginning of mem allocated
 - * for a slab, or allocated from an general cache.
 - * Slabs are chained into three list: fully used, partial, fully free slabs.
 - */
 -struct slab {
 -      struct list_head list;
 -      unsigned long colouroff;
 -      void *s_mem;            /* including colour offset */
 -      unsigned int inuse;     /* num of objs active in slab */
 -      kmem_bufctl_t free;
 -      unsigned short nodeid;
 -};
 -
  /*
   * struct slab_rcu
   *
   *
   * rcu_read_lock before reading the address, then rcu_read_unlock after
   * taking the spinlock within the structure expected at that address.
 - *
 - * We assume struct slab_rcu can overlay struct slab when destroying.
   */
  struct slab_rcu {
        struct rcu_head head;
        void *addr;
  };
  
 +/*
 + * struct slab
 + *
 + * Manages the objs in a slab. Placed either at the beginning of mem allocated
 + * for a slab, or allocated from an general cache.
 + * Slabs are chained into three list: fully used, partial, fully free slabs.
 + */
 +struct slab {
 +      union {
 +              struct {
 +                      struct list_head list;
 +                      unsigned long colouroff;
 +                      void *s_mem;            /* including colour offset */
 +                      unsigned int inuse;     /* num of objs active in slab */
 +                      kmem_bufctl_t free;
 +                      unsigned short nodeid;
 +              };
 +              struct slab_rcu __slab_cover_slab_rcu;
 +      };
 +};
 +
  /*
   * struct array_cache
   *
@@@ -2150,6 -2147,8 +2150,6 @@@ static int __init_refok setup_cpu_cache
   *
   * @name must be valid until the cache is destroyed. This implies that
   * the module calling this has to destroy the cache before getting unloaded.
 - * Note that kmem_cache_name() is not guaranteed to return the same pointer,
 - * therefore applications must manage it themselves.
   *
   * The flags are
   *
@@@ -2289,8 -2288,8 +2289,8 @@@ kmem_cache_create (const char *name, si
        if (ralign < align) {
                ralign = align;
        }
-       /* disable debug if not aligning with REDZONE_ALIGN */
-       if (ralign & (__alignof__(unsigned long long) - 1))
+       /* disable debug if necessary */
+       if (ralign > __alignof__(unsigned long long))
                flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
        /*
         * 4) Store it.
         */
        if (flags & SLAB_RED_ZONE) {
                /* add space for red zone words */
-               cachep->obj_offset += align;
-               size += align + sizeof(unsigned long long);
+               cachep->obj_offset += sizeof(unsigned long long);
+               size += 2 * sizeof(unsigned long long);
        }
        if (flags & SLAB_STORE_USER) {
                /* user store requires one word storage behind the end of
@@@ -3841,6 -3840,12 +3841,6 @@@ unsigned int kmem_cache_size(struct kme
  }
  EXPORT_SYMBOL(kmem_cache_size);
  
 -const char *kmem_cache_name(struct kmem_cache *cachep)
 -{
 -      return cachep->name;
 -}
 -EXPORT_SYMBOL_GPL(kmem_cache_name);
 -
  /*
   * This initializes kmem_list3 or resizes various caches for all nodes.
   */