Skip to contentSkip to conversation

mm: do not start node_reclaim for page order > MAX_ORDER

RFC PATCH In review Konstantin Khlebnikov 2 participants 2 messages Nov 1, 2018 – Nov 2, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 mm: do not start node_reclaim for page order > MAX_ORDER

Page allocator has check in __alloc_pages_slowpath() but nowdays there is earlier entry point into reclimer without such check:
get_page_from_freelist() -> node_reclaim().

---
 mm/vmscan.c |    6 ++++++
 1 file changed, 6 insertions(+)
mm/vmscan.c +6 -0
index 62ac0c488624..52f672420f0b 100644
@@ -4117,6 +4117,12 @@ int node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned int order)
 {
 	int ret;
 
+	/*
+	 * Do not scan if allocation will never succeed.
+	 */
+	if (order >= MAX_ORDER)
+		return NODE_RECLAIM_NOSCAN;
+
 	/*
 	 * Node reclaim reclaims unmapped file backed pages and
 	 * slab pages if we are over the defined limits.
reviewer
#1 lore raw
Quoted 3 lines · Konstantin Khlebnikov

Page allocator has check in __alloc_pages_slowpath() but nowdays there is earlier entry point into reclimer without such check:
get_page_from_freelist() -> node_reclaim().

Is the order check so expensive that it would be visible in the fast path? Spreading these MAX_ORDER checks sounds quite fragile to me.

Quoted 23 lines
---
 mm/vmscan.c |    6 ++++++
 1 file changed, 6 insertions(+)
mm/vmscan.c +6 -0
index 62ac0c488624..52f672420f0b 100644
@@ -4117,6 +4117,12 @@ int node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned int order)
 {
 	int ret;
 
+	/*
+	 * Do not scan if allocation will never succeed.
+	 */
+	if (order >= MAX_ORDER)
+		return NODE_RECLAIM_NOSCAN;
+
 	/*
 	 * Node reclaim reclaims unmapped file backed pages and
 	 * slab pages if we are over the defined limits.
Signature · 2 lines
Michal Hocko
SUSE Labs