diff options
-rw-r--r-- | mm/slab.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -1180,6 +1180,12 @@ static int init_cache_node_node(int node) | |||
1180 | return 0; | 1180 | return 0; |
1181 | } | 1181 | } |
1182 | 1182 | ||
1183 | static inline int slabs_tofree(struct kmem_cache *cachep, | ||
1184 | struct kmem_cache_node *n) | ||
1185 | { | ||
1186 | return (n->free_objects + cachep->num - 1) / cachep->num; | ||
1187 | } | ||
1188 | |||
1183 | static void __cpuinit cpuup_canceled(long cpu) | 1189 | static void __cpuinit cpuup_canceled(long cpu) |
1184 | { | 1190 | { |
1185 | struct kmem_cache *cachep; | 1191 | struct kmem_cache *cachep; |
@@ -1241,7 +1247,7 @@ free_array_cache: | |||
1241 | n = cachep->node[node]; | 1247 | n = cachep->node[node]; |
1242 | if (!n) | 1248 | if (!n) |
1243 | continue; | 1249 | continue; |
1244 | drain_freelist(cachep, n, n->free_objects); | 1250 | drain_freelist(cachep, n, slabs_tofree(cachep, n)); |
1245 | } | 1251 | } |
1246 | } | 1252 | } |
1247 | 1253 | ||
@@ -1408,7 +1414,7 @@ static int __meminit drain_cache_node_node(int node) | |||
1408 | if (!n) | 1414 | if (!n) |
1409 | continue; | 1415 | continue; |
1410 | 1416 | ||
1411 | drain_freelist(cachep, n, n->free_objects); | 1417 | drain_freelist(cachep, n, slabs_tofree(cachep, n)); |
1412 | 1418 | ||
1413 | if (!list_empty(&n->slabs_full) || | 1419 | if (!list_empty(&n->slabs_full) || |
1414 | !list_empty(&n->slabs_partial)) { | 1420 | !list_empty(&n->slabs_partial)) { |
@@ -2534,7 +2540,7 @@ static int __cache_shrink(struct kmem_cache *cachep) | |||
2534 | if (!n) | 2540 | if (!n) |
2535 | continue; | 2541 | continue; |
2536 | 2542 | ||
2537 | drain_freelist(cachep, n, n->free_objects); | 2543 | drain_freelist(cachep, n, slabs_tofree(cachep, n)); |
2538 | 2544 | ||
2539 | ret += !list_empty(&n->slabs_full) || | 2545 | ret += !list_empty(&n->slabs_full) || |
2540 | !list_empty(&n->slabs_partial); | 2546 | !list_empty(&n->slabs_partial); |