diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-05 14:26:38 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-05 14:26:38 -0500 |
commit | 7a21ef6fe902ac0ad53b45af6851ae5ec3a64299 (patch) | |
tree | 1e8c690f6fb644c8ce8873c7907ef0ed934446df | |
parent | c265c46bbb8c53db0bd084261ab2996c6d74aebf (diff) |
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: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | mm/slab.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -900,12 +900,18 @@ static void drain_alien_cache(struct kmem_cache *cachep, struct array_cache **al | |||
900 | } | 900 | } |
901 | } | 901 | } |
902 | #else | 902 | #else |
903 | #define alloc_alien_cache(node, limit) do { } while (0) | 903 | |
904 | #define drain_alien_cache(cachep, alien) do { } while (0) | 904 | #define drain_alien_cache(cachep, alien) do { } while (0) |
905 | 905 | ||
906 | static inline struct array_cache **alloc_alien_cache(int node, int limit) | ||
907 | { | ||
908 | return (struct array_cache **) 0x01020304ul; | ||
909 | } | ||
910 | |||
906 | static inline void free_alien_cache(struct array_cache **ac_ptr) | 911 | static inline void free_alien_cache(struct array_cache **ac_ptr) |
907 | { | 912 | { |
908 | } | 913 | } |
914 | |||
909 | #endif | 915 | #endif |
910 | 916 | ||
911 | static int __devinit cpuup_callback(struct notifier_block *nfb, | 917 | static int __devinit cpuup_callback(struct notifier_block *nfb, |
@@ -970,11 +976,10 @@ static int __devinit cpuup_callback(struct notifier_block *nfb, | |||
970 | 0xbaadf00d); | 976 | 0xbaadf00d); |
971 | if (!shared) | 977 | if (!shared) |
972 | goto bad; | 978 | goto bad; |
973 | #ifdef CONFIG_NUMA | 979 | |
974 | alien = alloc_alien_cache(node, cachep->limit); | 980 | alien = alloc_alien_cache(node, cachep->limit); |
975 | if (!alien) | 981 | if (!alien) |
976 | goto bad; | 982 | goto bad; |
977 | #endif | ||
978 | cachep->array[cpu] = nc; | 983 | cachep->array[cpu] = nc; |
979 | 984 | ||
980 | l3 = cachep->nodelists[node]; | 985 | l3 = cachep->nodelists[node]; |