aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slub.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/slub.c')
-rw-r--r--mm/slub.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/mm/slub.c b/mm/slub.c
index 3d3a8a7a0f8c..25f14ad8f817 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1518,11 +1518,9 @@ static void discard_slab(struct kmem_cache *s, struct page *page)
1518/* 1518/*
1519 * Management of partially allocated slabs. 1519 * Management of partially allocated slabs.
1520 */ 1520 */
1521static inline void add_partial(struct kmem_cache_node *n, 1521static inline void
1522 struct page *page, int tail) 1522__add_partial(struct kmem_cache_node *n, struct page *page, int tail)
1523{ 1523{
1524 lockdep_assert_held(&n->list_lock);
1525
1526 n->nr_partial++; 1524 n->nr_partial++;
1527 if (tail == DEACTIVATE_TO_TAIL) 1525 if (tail == DEACTIVATE_TO_TAIL)
1528 list_add_tail(&page->lru, &n->partial); 1526 list_add_tail(&page->lru, &n->partial);
@@ -1530,15 +1528,27 @@ static inline void add_partial(struct kmem_cache_node *n,
1530 list_add(&page->lru, &n->partial); 1528 list_add(&page->lru, &n->partial);
1531} 1529}
1532 1530
1533static inline void remove_partial(struct kmem_cache_node *n, 1531static inline void add_partial(struct kmem_cache_node *n,
1534 struct page *page) 1532 struct page *page, int tail)
1535{ 1533{
1536 lockdep_assert_held(&n->list_lock); 1534 lockdep_assert_held(&n->list_lock);
1535 __add_partial(n, page, tail);
1536}
1537 1537
1538static inline void
1539__remove_partial(struct kmem_cache_node *n, struct page *page)
1540{
1538 list_del(&page->lru); 1541 list_del(&page->lru);
1539 n->nr_partial--; 1542 n->nr_partial--;
1540} 1543}
1541 1544
1545static inline void remove_partial(struct kmem_cache_node *n,
1546 struct page *page)
1547{
1548 lockdep_assert_held(&n->list_lock);
1549 __remove_partial(n, page);
1550}
1551
1542/* 1552/*
1543 * Remove slab from the partial list, freeze it and 1553 * Remove slab from the partial list, freeze it and
1544 * return the pointer to the freelist. 1554 * return the pointer to the freelist.
@@ -2904,12 +2914,10 @@ static void early_kmem_cache_node_alloc(int node)
2904 inc_slabs_node(kmem_cache_node, node, page->objects); 2914 inc_slabs_node(kmem_cache_node, node, page->objects);
2905 2915
2906 /* 2916 /*
2907 * the lock is for lockdep's sake, not for any actual 2917 * No locks need to be taken here as it has just been
2908 * race protection 2918 * initialized and there is no concurrent access.
2909 */ 2919 */
2910 spin_lock(&n->list_lock); 2920 __add_partial(n, page, DEACTIVATE_TO_HEAD);
2911 add_partial(n, page, DEACTIVATE_TO_HEAD);
2912 spin_unlock(&n->list_lock);
2913} 2921}
2914 2922
2915static void free_kmem_cache_nodes(struct kmem_cache *s) 2923static void free_kmem_cache_nodes(struct kmem_cache *s)
@@ -3195,7 +3203,7 @@ static void free_partial(struct kmem_cache *s, struct kmem_cache_node *n)
3195 3203
3196 list_for_each_entry_safe(page, h, &n->partial, lru) { 3204 list_for_each_entry_safe(page, h, &n->partial, lru) {
3197 if (!page->inuse) { 3205 if (!page->inuse) {
3198 remove_partial(n, page); 3206 __remove_partial(n, page);
3199 discard_slab(s, page); 3207 discard_slab(s, page);
3200 } else { 3208 } else {
3201 list_slab_objects(s, page, 3209 list_slab_objects(s, page,