Skip to content

Commit

Permalink
kmemcheck: move hook into __alloc_pages_nodemask() for the page alloc…
Browse files Browse the repository at this point in the history
…ator

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()
	...

Signed-off-by: Xishi Qiu <qiuxishi@huawei.com>
Cc: Vegard Nossum <vegard.nossum@oracle.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Li Zefan <lizefan@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Xishi Qiu authored and Linus Torvalds committed Feb 12, 2015
1 parent 91fbdc0 commit 23f086f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2842,11 +2842,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,

nopage:
warn_alloc_failed(gfp_mask, order, NULL);
return page;
got_pg:
if (kmemcheck_enabled)
kmemcheck_pagealloc_alloc(page, order, gfp_mask);

return page;
}

Expand Down Expand Up @@ -2916,6 +2912,9 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
preferred_zone, classzone_idx, migratetype);
}

if (kmemcheck_enabled && page)
kmemcheck_pagealloc_alloc(page, order, gfp_mask);

trace_mm_page_alloc(page, order, alloc_mask, migratetype);

out:
Expand Down

0 comments on commit 23f086f

Please sign in to comment.