Rev 776 | Rev 780 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 776 | Rev 778 | ||
---|---|---|---|
Line 754... | Line 754... | ||
754 | cache->flags & SLAB_CACHE_SLINSIDE ? "In" : "Out"); |
754 | cache->flags & SLAB_CACHE_SLINSIDE ? "In" : "Out"); |
755 | } |
755 | } |
756 | spinlock_unlock(&slab_cache_lock); |
756 | spinlock_unlock(&slab_cache_lock); |
757 | } |
757 | } |
758 | 758 | ||
- | 759 | #ifdef CONFIG_DEBUG |
|
- | 760 | static int _slab_initialized = 0; |
|
- | 761 | #endif |
|
- | 762 | ||
759 | void slab_cache_init(void) |
763 | void slab_cache_init(void) |
760 | { |
764 | { |
761 | int i, size; |
765 | int i, size; |
762 | 766 | ||
763 | /* Initialize magazine cache */ |
767 | /* Initialize magazine cache */ |
Line 786... | Line 790... | ||
786 | i++, size <<= 1) { |
790 | i++, size <<= 1) { |
787 | malloc_caches[i] = slab_cache_create(malloc_names[i], |
791 | malloc_caches[i] = slab_cache_create(malloc_names[i], |
788 | size, 0, |
792 | size, 0, |
789 | NULL,NULL,0); |
793 | NULL,NULL,0); |
790 | } |
794 | } |
- | 795 | #ifdef CONFIG_DEBUG |
|
- | 796 | _slab_initialized = 1; |
|
- | 797 | #endif |
|
791 | } |
798 | } |
792 | 799 | ||
793 | /**************************************/ |
800 | /**************************************/ |
794 | /* kalloc/kfree functions */ |
801 | /* kalloc/kfree functions */ |
795 | void * kalloc(unsigned int size, int flags) |
802 | void * kalloc(unsigned int size, int flags) |
796 | { |
803 | { |
797 | int idx; |
804 | int idx; |
798 | 805 | ||
- | 806 | ASSERT(_slab_initialized); |
|
799 | ASSERT( size && size <= (1 << SLAB_MAX_MALLOC_W)); |
807 | ASSERT( size && size <= (1 << SLAB_MAX_MALLOC_W)); |
800 | 808 | ||
801 | if (size < (1 << SLAB_MIN_MALLOC_W)) |
809 | if (size < (1 << SLAB_MIN_MALLOC_W)) |
802 | size = (1 << SLAB_MIN_MALLOC_W); |
810 | size = (1 << SLAB_MIN_MALLOC_W); |
803 | 811 |