aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Beregalov <a.beregalov@gmail.com>2009-06-11 06:08:48 -0400
committerPekka Enberg <penberg@cs.helsinki.fi>2009-06-13 16:37:37 -0400
commit26c02cf05ddadfee3952e829b841583794bf46f6 (patch)
treea0075e3eabc21470f2092b944714ef6581f2fff4
parent781b2ba6eb5f22440afac9c79a89ebd6e3674a60 (diff)
SLUB: fix build when !SLUB_DEBUG
Fix this build error when CONFIG_SLUB_DEBUG is not set: mm/slub.c: In function 'slab_out_of_memory': mm/slub.c:1551: error: 'struct kmem_cache_node' has no member named 'nr_slabs' mm/slub.c:1552: error: 'struct kmem_cache_node' has no member named 'total_objects' [ penberg@cs.helsinki.fi: cleanups ] Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
-rw-r--r--mm/slub.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/mm/slub.c b/mm/slub.c
index a5a4ecf7e393..9fb892b6afe3 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -832,6 +832,11 @@ static inline unsigned long slabs_node(struct kmem_cache *s, int node)
832 return atomic_long_read(&n->nr_slabs); 832 return atomic_long_read(&n->nr_slabs);
833} 833}
834 834
835static inline unsigned long node_nr_slabs(struct kmem_cache_node *n)
836{
837 return atomic_long_read(&n->nr_slabs);
838}
839
835static inline void inc_slabs_node(struct kmem_cache *s, int node, int objects) 840static inline void inc_slabs_node(struct kmem_cache *s, int node, int objects)
836{ 841{
837 struct kmem_cache_node *n = get_node(s, node); 842 struct kmem_cache_node *n = get_node(s, node);
@@ -1050,6 +1055,8 @@ static inline unsigned long kmem_cache_flags(unsigned long objsize,
1050 1055
1051static inline unsigned long slabs_node(struct kmem_cache *s, int node) 1056static inline unsigned long slabs_node(struct kmem_cache *s, int node)
1052 { return 0; } 1057 { return 0; }
1058static inline unsigned long node_nr_slabs(struct kmem_cache_node *n)
1059 { return 0; }
1053static inline void inc_slabs_node(struct kmem_cache *s, int node, 1060static inline void inc_slabs_node(struct kmem_cache *s, int node,
1054 int objects) {} 1061 int objects) {}
1055static inline void dec_slabs_node(struct kmem_cache *s, int node, 1062static inline void dec_slabs_node(struct kmem_cache *s, int node,
@@ -1503,6 +1510,15 @@ static unsigned long count_partial(struct kmem_cache_node *n,
1503 return x; 1510 return x;
1504} 1511}
1505 1512
1513static inline unsigned long node_nr_objs(struct kmem_cache_node *n)
1514{
1515#ifdef CONFIG_SLUB_DEBUG
1516 return atomic_long_read(&n->total_objects);
1517#else
1518 return 0;
1519#endif
1520}
1521
1506static noinline void 1522static noinline void
1507slab_out_of_memory(struct kmem_cache *s, gfp_t gfpflags, int nid) 1523slab_out_of_memory(struct kmem_cache *s, gfp_t gfpflags, int nid)
1508{ 1524{
@@ -1524,9 +1540,9 @@ slab_out_of_memory(struct kmem_cache *s, gfp_t gfpflags, int nid)
1524 if (!n) 1540 if (!n)
1525 continue; 1541 continue;
1526 1542
1527 nr_slabs = atomic_long_read(&n->nr_slabs); 1543 nr_free = count_partial(n, count_free);
1528 nr_objs = atomic_long_read(&n->total_objects); 1544 nr_slabs = node_nr_slabs(n);
1529 nr_free = count_partial(n, count_free); 1545 nr_objs = node_nr_objs(n);
1530 1546
1531 printk(KERN_WARNING 1547 printk(KERN_WARNING
1532 " node %d: slabs: %ld, objs: %ld, free: %ld\n", 1548 " node %d: slabs: %ld, objs: %ld, free: %ld\n",