/* Higher order allocations also allow the placement of more objects in a slab and thereby reduce object handling overhead. If the user has requested a higher mininum order then we start with that one instead of the smallest order which will fit the object.  */
static int slab_order(int size, int min_objects, int max_order, int fract_leftover)
/* Higher order allocations also allow the placement of more objects in a slab and thereby reduce object handling overhead. If the user has requested a higher mininum order then we start with that one instead of the smallest order which will fit the object.  */
static int slab_order(int size, int min_objects, int max_order, int fract_leftover)
{
	int order;
	int rem;
	int min_order = slub_min_order;
	if ((PAGE_SIZE << min_order) / size > MAX_OBJS_PER_PAGE)
		return get_order(size * MAX_OBJS_PER_PAGE) - 1;
	for (order = max(min_order,
				fls(min_objects * size - 1) - PAGE_SHIFT);
			order <= max_order; order++) {
		unsigned long slab_size = PAGE_SIZE << order;
		if (slab_size < min_objects * size)
			continue;
		rem = slab_size % size;
		if (rem <= slab_size / fract_leftover)
			break;
	}
	return order;
}