aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/slab.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/mm/slab.c b/mm/slab.c
index f6ad8d335be7..8d9a0fff160d 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -791,13 +791,8 @@ static void start_cpu_timer(int cpu)
791 } 791 }
792} 792}
793 793
794static struct array_cache *alloc_arraycache(int node, int entries, 794static void init_arraycache(struct array_cache *ac, int limit, int batch)
795 int batchcount, gfp_t gfp)
796{ 795{
797 int memsize = sizeof(void *) * entries + sizeof(struct array_cache);
798 struct array_cache *nc = NULL;
799
800 nc = kmalloc_node(memsize, gfp, node);
801 /* 796 /*
802 * The array_cache structures contain pointers to free object. 797 * The array_cache structures contain pointers to free object.
803 * However, when such objects are allocated or transferred to another 798 * However, when such objects are allocated or transferred to another
@@ -805,15 +800,25 @@ static struct array_cache *alloc_arraycache(int node, int entries,
805 * valid references during a kmemleak scan. Therefore, kmemleak must 800 * valid references during a kmemleak scan. Therefore, kmemleak must
806 * not scan such objects. 801 * not scan such objects.
807 */ 802 */
808 kmemleak_no_scan(nc); 803 kmemleak_no_scan(ac);
809 if (nc) { 804 if (ac) {
810 nc->avail = 0; 805 ac->avail = 0;
811 nc->limit = entries; 806 ac->limit = limit;
812 nc->batchcount = batchcount; 807 ac->batchcount = batch;
813 nc->touched = 0; 808 ac->touched = 0;
814 spin_lock_init(&nc->lock); 809 spin_lock_init(&ac->lock);
815 } 810 }
816 return nc; 811}
812
813static struct array_cache *alloc_arraycache(int node, int entries,
814 int batchcount, gfp_t gfp)
815{
816 int memsize = sizeof(void *) * entries + sizeof(struct array_cache);
817 struct array_cache *ac = NULL;
818
819 ac = kmalloc_node(memsize, gfp, node);
820 init_arraycache(ac, entries, batchcount);
821 return ac;
817} 822}
818 823
819static inline bool is_slab_pfmemalloc(struct page *page) 824static inline bool is_slab_pfmemalloc(struct page *page)