Skip to contentSkip to conversation

mm/slub: calculate start order with reserved in consideration

PATCH In review Wei Yang 2 participants 3 messages Sep 30, 2015

Subsystems (2)
lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/1 mm/slub: calculate start order with reserved in consideration

In function slub_order(), the order starts from max(min_order, get_order(min_objects * size)). When (min_objects * size) has different order with (min_objects * size + reserved), it will skip this order by the check in the loop.

This patch optimizes this a little by calculating the start order with reserved in consideration and remove the check in loop.

---
This patch is based on the previous one "mm/slub: use get_order() instead of fls()", so may not apply on current tree.

---
 mm/slub.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
mm/slub.c +1 -5
index e309ed1..e1bb147 100644
@@ -2912,19 +2912,15 @@ static inline int slab_order(int size, int min_objects,
 	if (order_objects(min_order, size, reserved) > MAX_OBJS_PER_PAGE)
 		return get_order(size * MAX_OBJS_PER_PAGE) - 1;
 
-	for (order = max(min_order, get_order(min_objects * size));
+	for (order = max(min_order, get_order(min_objects * size + reserved));
 			order <= max_order; order++) {
 
 		unsigned long slab_size = PAGE_SIZE << order;
 
-		if (slab_size < min_objects * size + reserved)
-			continue;
-
 		rem = (slab_size - reserved) % size;
 
 		if (rem <= slab_size / fract_leftover)
 			break;
-
 	}
 
 	return order;
Signature · 7 lines
2.5.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Wei Yang

In function slub_order(), the order starts from max(min_order, get_order(min_objects * size)). When (min_objects * size) has different order with (min_objects * size + reserved), it will skip this order by the check in the loop.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#2 lore raw
Quoted 8 lines · Christoph Lameter
Quoted 4 lines · Wei Yang

In function slub_order(), the order starts from max(min_order, get_order(min_objects * size)). When (min_objects * size) has different order with (min_objects * size + reserved), it will skip this order by the check in the loop.

Christoph,

Glad to see your Ack.
Thanks :-)

BTW, do you have any comment for this patch "mm/slub: correct the comment in calculate_order()"? I hope my understanding is correct.

Signature · 8 lines
Richard Yang
Help you, Help me

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>