diff options
Diffstat (limited to 'mm/slub.c')
-rw-r--r-- | mm/slub.c | 22 |
1 files changed, 19 insertions, 3 deletions
@@ -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 | ||
835 | static inline unsigned long node_nr_slabs(struct kmem_cache_node *n) | ||
836 | { | ||
837 | return atomic_long_read(&n->nr_slabs); | ||
838 | } | ||
839 | |||
835 | static inline void inc_slabs_node(struct kmem_cache *s, int node, int objects) | 840 | static 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 | ||
1051 | static inline unsigned long slabs_node(struct kmem_cache *s, int node) | 1056 | static inline unsigned long slabs_node(struct kmem_cache *s, int node) |
1052 | { return 0; } | 1057 | { return 0; } |
1058 | static inline unsigned long node_nr_slabs(struct kmem_cache_node *n) | ||
1059 | { return 0; } | ||
1053 | static inline void inc_slabs_node(struct kmem_cache *s, int node, | 1060 | static inline void inc_slabs_node(struct kmem_cache *s, int node, |
1054 | int objects) {} | 1061 | int objects) {} |
1055 | static inline void dec_slabs_node(struct kmem_cache *s, int node, | 1062 | 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, | |||
1503 | return x; | 1510 | return x; |
1504 | } | 1511 | } |
1505 | 1512 | ||
1513 | static 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 | |||
1506 | static noinline void | 1522 | static noinline void |
1507 | slab_out_of_memory(struct kmem_cache *s, gfp_t gfpflags, int nid) | 1523 | slab_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", |