On Mon, 11 Mar 2019, Roman Gushchin wrote: > > +static inline void *alloc_scratch(struct kmem_cache *s) > > +{ > > + unsigned int size = oo_objects(s->max); > > + > > + return kmalloc(size * sizeof(void *) + > > + BITS_TO_LONGS(size) * sizeof(unsigned long), > > + GFP_KERNEL); > > I wonder how big this allocation can be? > Given that the reason for migration is probably highly fragmented memory, > we probably don't want to have a high-order allocation here. So maybe > kvmalloc()? The smallest object size is 8 bytes which is one word which would be places in an order 0 page. So it comes out to about a page again. Larger allocation orders are possible if the slab pages itself can have larger orders of course. If you set the min_order to the huge page order then we can have similar sized orders for the allocation of the scratch space. However, that is not a problem since the allocations for the slab pages itself are also already of that same order.