diff options
-rw-r--r-- | mm/slab.c | 37 |
1 files changed, 19 insertions, 18 deletions
@@ -759,6 +759,7 @@ static enum { | |||
759 | NONE, | 759 | NONE, |
760 | PARTIAL_AC, | 760 | PARTIAL_AC, |
761 | PARTIAL_L3, | 761 | PARTIAL_L3, |
762 | EARLY, | ||
762 | FULL | 763 | FULL |
763 | } g_cpucache_up; | 764 | } g_cpucache_up; |
764 | 765 | ||
@@ -767,7 +768,7 @@ static enum { | |||
767 | */ | 768 | */ |
768 | int slab_is_available(void) | 769 | int slab_is_available(void) |
769 | { | 770 | { |
770 | return g_cpucache_up == FULL; | 771 | return g_cpucache_up >= EARLY; |
771 | } | 772 | } |
772 | 773 | ||
773 | static DEFINE_PER_CPU(struct delayed_work, reap_work); | 774 | static DEFINE_PER_CPU(struct delayed_work, reap_work); |
@@ -1631,19 +1632,27 @@ void __init kmem_cache_init(void) | |||
1631 | } | 1632 | } |
1632 | } | 1633 | } |
1633 | 1634 | ||
1634 | /* 6) resize the head arrays to their final sizes */ | 1635 | g_cpucache_up = EARLY; |
1635 | { | ||
1636 | struct kmem_cache *cachep; | ||
1637 | mutex_lock(&cache_chain_mutex); | ||
1638 | list_for_each_entry(cachep, &cache_chain, next) | ||
1639 | if (enable_cpucache(cachep, GFP_NOWAIT)) | ||
1640 | BUG(); | ||
1641 | mutex_unlock(&cache_chain_mutex); | ||
1642 | } | ||
1643 | 1636 | ||
1644 | /* Annotate slab for lockdep -- annotate the malloc caches */ | 1637 | /* Annotate slab for lockdep -- annotate the malloc caches */ |
1645 | init_lock_keys(); | 1638 | init_lock_keys(); |
1639 | } | ||
1640 | |||
1641 | void __init kmem_cache_init_late(void) | ||
1642 | { | ||
1643 | struct kmem_cache *cachep; | ||
1644 | |||
1645 | /* | ||
1646 | * Interrupts are enabled now so all GFP allocations are safe. | ||
1647 | */ | ||
1648 | slab_gfp_mask = __GFP_BITS_MASK; | ||
1646 | 1649 | ||
1650 | /* 6) resize the head arrays to their final sizes */ | ||
1651 | mutex_lock(&cache_chain_mutex); | ||
1652 | list_for_each_entry(cachep, &cache_chain, next) | ||
1653 | if (enable_cpucache(cachep, GFP_NOWAIT)) | ||
1654 | BUG(); | ||
1655 | mutex_unlock(&cache_chain_mutex); | ||
1647 | 1656 | ||
1648 | /* Done! */ | 1657 | /* Done! */ |
1649 | g_cpucache_up = FULL; | 1658 | g_cpucache_up = FULL; |
@@ -1660,14 +1669,6 @@ void __init kmem_cache_init(void) | |||
1660 | */ | 1669 | */ |
1661 | } | 1670 | } |
1662 | 1671 | ||
1663 | void __init kmem_cache_init_late(void) | ||
1664 | { | ||
1665 | /* | ||
1666 | * Interrupts are enabled now so all GFP allocations are safe. | ||
1667 | */ | ||
1668 | slab_gfp_mask = __GFP_BITS_MASK; | ||
1669 | } | ||
1670 | |||
1671 | static int __init cpucache_init(void) | 1672 | static int __init cpucache_init(void) |
1672 | { | 1673 | { |
1673 | int cpu; | 1674 | int cpu; |