Skip to contentSkip to conversation

mm/compaction: remove unnecessary order check in try_to_compact_pages()

PATCH Applied Ganesh Mahendran 3 participants 3 messages Jun 15, 2016 – Jun 24, 2016

Subsystems (2)

v1 of 3 Applied 1/1 Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/compaction: remove unnecessary order check in try_to_compact_pages()

The caller __alloc_pages_direct_compact() already check (order == 0). So no need to check again.

---
 mm/compaction.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/compaction.c +1 -1
index fbb7b38..500acda 100644
@@ -1687,7 +1687,7 @@ enum compact_result try_to_compact_pages(gfp_t gfp_mask, unsigned int order,
 	*contended = COMPACT_CONTENDED_NONE;
 
 	/* Check if the GFP flags allow compaction */
-	if (!order || !may_enter_fs || !may_perform_io)
+	if (!may_enter_fs || !may_perform_io)
 		return COMPACT_SKIPPED;
 
 	trace_mm_compaction_try_to_compact_pages(order, gfp_mask, mode);
Signature · 7 lines
1.9.1

--
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>
#1 lore raw
Quoted 2 lines · Ganesh Mahendran

The caller __alloc_pages_direct_compact() already check (order == 0). So no need to check again.

Yeah, the caller (__alloc_pages_direct_compact) checks if the order of allocation is 0. But we can remove it there and keep it in here as this is the actual entry point for direct page compaction.

--
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>

maintainer
#2 lore raw
Quoted 7 lines · On Wed, 15 Jun 2016 14:16:20 +0530 Anshuman Khandual…
Quoted 2 lines · Ganesh Mahendran

The caller __alloc_pages_direct_compact() already check (order == 0). So no need to check again.

Yeah, the caller (__alloc_pages_direct_compact) checks if the order of allocation is 0. But we can remove it there and keep it in here as this is the actual entry point for direct page compaction.

I think the check in __alloc_pages_direct_compact() is OK - it's a bit silly to do a (small) bunch of additional work in __alloc_pages_direct_compact() when orer==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>