Skip to contentSkip to conversation

kmemcheck: move hook into __alloc_pages_nodemask() for the page allocator

PATCH New Xishi Qiu 1 participant 1 message Mar 18, 2014

Subsystems (2)
lore
Share & tools
lore

Xishi Qiu

author
#0 lore raw

PATCH 1/1 kmemcheck: move hook into __alloc_pages_nodemask() for the page allocator

Now kmemcheck_pagealloc_alloc() is only called by __alloc_pages_slowpath(). __alloc_pages_nodemask()
__alloc_pages_slowpath()
kmemcheck_pagealloc_alloc()

And the page will not be tracked by kmemcheck in the following path. __alloc_pages_nodemask()
get_page_from_freelist()

So move kmemcheck_pagealloc_alloc() into __alloc_pages_nodemask(), like this:
__alloc_pages_nodemask()

	...
	get_page_from_freelist()
	if (!page)
		__alloc_pages_slowpath()
	kmemcheck_pagealloc_alloc()
	...
---
 mm/page_alloc.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
mm/page_alloc.c +2 -4
index e3758a0..ce596b4 100644
@@ -2671,11 +2671,7 @@ rebalance:
 
 nopage:
 	warn_alloc_failed(gfp_mask, order, NULL);
-	return page;
 got_pg:
-	if (kmemcheck_enabled)
-		kmemcheck_pagealloc_alloc(page, order, gfp_mask);
-
 	return page;
 }
 
@@ -2748,6 +2744,8 @@ retry_cpuset:
 				preferred_zone, migratetype);
 	}
 
+	if (kmemcheck_enabled && page)
+		kmemcheck_pagealloc_alloc(page, order, gfp_mask);
 	trace_mm_page_alloc(page, order, gfp_mask, migratetype);
 
 out:
Signature · 8 lines
1.7.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>