Commit 7a21ef6f authored by Linus Torvalds's avatar Linus Torvalds

mm/slab.c (non-NUMA): Fix compile warning and clean up code

The non-NUMA case would do an unmatched "free_alien_cache()" on an alien
pointer that had never been allocated.

It might not matter from a code generation standpoint (since in the
non-NUMA case, the code doesn't actually _do_ anything), but it not only
results in a compiler warning, it's really really ugly too.

Fix the compiler warning by just having a matching dummy allocation.
That also avoids an unnecessary #ifdef in the code.
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c265c46b
...@@ -900,12 +900,18 @@ static void drain_alien_cache(struct kmem_cache *cachep, struct array_cache **al ...@@ -900,12 +900,18 @@ static void drain_alien_cache(struct kmem_cache *cachep, struct array_cache **al
} }
} }
#else #else
#define alloc_alien_cache(node, limit) do { } while (0)
#define drain_alien_cache(cachep, alien) do { } while (0) #define drain_alien_cache(cachep, alien) do { } while (0)
static inline struct array_cache **alloc_alien_cache(int node, int limit)
{
return (struct array_cache **) 0x01020304ul;
}
static inline void free_alien_cache(struct array_cache **ac_ptr) static inline void free_alien_cache(struct array_cache **ac_ptr)
{ {
} }
#endif #endif
static int __devinit cpuup_callback(struct notifier_block *nfb, static int __devinit cpuup_callback(struct notifier_block *nfb,
...@@ -970,11 +976,10 @@ static int __devinit cpuup_callback(struct notifier_block *nfb, ...@@ -970,11 +976,10 @@ static int __devinit cpuup_callback(struct notifier_block *nfb,
0xbaadf00d); 0xbaadf00d);
if (!shared) if (!shared)
goto bad; goto bad;
#ifdef CONFIG_NUMA
alien = alloc_alien_cache(node, cachep->limit); alien = alloc_alien_cache(node, cachep->limit);
if (!alien) if (!alien)
goto bad; goto bad;
#endif
cachep->array[cpu] = nc; cachep->array[cpu] = nc;
l3 = cachep->nodelists[node]; l3 = cachep->nodelists[node];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment