summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorAlexander Beregalov <a.beregalov@gmail.com>2009-06-11 14:08:48 +0400
committerPekka Enberg <penberg@cs.helsinki.fi>2009-06-13 23:37:37 +0300
commit26c02cf05ddadfee3952e829b841583794bf46f6 (patch)
treea0075e3eabc21470f2092b944714ef6581f2fff4 /mm
parent781b2ba6eb5f22440afac9c79a89ebd6e3674a60 (diff)
downloadop-kernel-dev-26c02cf05ddadfee3952e829b841583794bf46f6.zip
op-kernel-dev-26c02cf05ddadfee3952e829b841583794bf46f6.tar.gz
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>
Diffstat (limited to 'mm')
-rw-r--r--mm/slub.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/mm/slub.c b/mm/slub.c
index a5a4ecf..9fb892b 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)
return atomic_long_read(&n->nr_slabs);
}
+static inline unsigned long node_nr_slabs(struct kmem_cache_node *n)
+{
+ return atomic_long_read(&n->nr_slabs);
+}
+
static inline void inc_slabs_node(struct kmem_cache *s, int node, int objects)
{
struct kmem_cache_node *n = get_node(s, node);
@@ -1050,6 +1055,8 @@ static inline unsigned long kmem_cache_flags(unsigned long objsize,
static inline unsigned long slabs_node(struct kmem_cache *s, int node)
{ return 0; }
+static inline unsigned long node_nr_slabs(struct kmem_cache_node *n)
+ { return 0; }
static inline void inc_slabs_node(struct kmem_cache *s, int node,
int objects) {}
static 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,
return x;
}
+static inline unsigned long node_nr_objs(struct kmem_cache_node *n)
+{
+#ifdef CONFIG_SLUB_DEBUG
+ return atomic_long_read(&n->total_objects);
+#else
+ return 0;
+#endif
+}
+
static noinline void
slab_out_of_memory(struct kmem_cache *s, gfp_t gfpflags, int nid)
{
@@ -1524,9 +1540,9 @@ slab_out_of_memory(struct kmem_cache *s, gfp_t gfpflags, int nid)
if (!n)
continue;
- nr_slabs = atomic_long_read(&n->nr_slabs);
- nr_objs = atomic_long_read(&n->total_objects);
- nr_free = count_partial(n, count_free);
+ nr_free = count_partial(n, count_free);
+ nr_slabs = node_nr_slabs(n);
+ nr_objs = node_nr_objs(n);
printk(KERN_WARNING
" node %d: slabs: %ld, objs: %ld, free: %ld\n",
OpenPOWER on IntegriCloud