[PATCH] mm/page_alloc.c: improve allocation fast path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Yue Hu <huyue2@xxxxxxxxxxx>

We currently is taking time to check if the watermark is safe when
alloc_flags is setting with ALLOC_NO_WATERMARK in slowpath, the check
to alloc_flags is faster check which should be first check option
compared to the slow check of watermark, it could benefit to urgency
allocation request in slowpath, it also almost has no effect for
allocation with successful watermark check.

Signed-off-by: Yue Hu <huyue2@xxxxxxxxxxx>
---
 mm/page_alloc.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 07efbc3..f1ba0e37 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3014,16 +3014,16 @@ static bool zone_allows_reclaim(struct zone *local_zone, struct zone *zone)
 			}
 		}
 
+		/* Checked here to keep the fast path fast */
+		BUILD_BUG_ON(ALLOC_NO_WATERMARKS < NR_WMARK);
+		if (alloc_flags & ALLOC_NO_WATERMARKS)
+			goto try_this_zone;
+
 		mark = zone->watermark[alloc_flags & ALLOC_WMARK_MASK];
 		if (!zone_watermark_fast(zone, order, mark,
 				       ac_classzone_idx(ac), alloc_flags)) {
 			int ret;
 
-			/* Checked here to keep the fast path fast */
-			BUILD_BUG_ON(ALLOC_NO_WATERMARKS < NR_WMARK);
-			if (alloc_flags & ALLOC_NO_WATERMARKS)
-				goto try_this_zone;
-
 			if (node_reclaim_mode == 0 ||
 			    !zone_allows_reclaim(ac->preferred_zoneref->zone, zone))
 				continue;
-- 
1.7.10.4

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



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux