Commit ce8f86ee authored by Hailong liu's avatar Hailong liu Committed by Linus Torvalds
Browse files

mm/page_alloc: add a missing mm_page_alloc_zone_locked() tracepoint

The trace point *trace_mm_page_alloc_zone_locked()* in __rmqueue() does
not currently cover all branches.  Add the missing tracepoint and check
the page before do that.

[akpm@linux-foundation.org: use IS_ENABLED() to suppress warning]

Link: https://lkml.kernel.org/r/20201228132901.41523-1-carver4lio@163.com


Signed-off-by: default avatarHailong liu <liu.hailong6@zte.com.cn>
Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8ff60eb0
Loading
Loading
Loading
Loading
+16 −15
Original line number Diff line number Diff line
@@ -2862,7 +2862,7 @@ __rmqueue(struct zone *zone, unsigned int order, int migratetype,
{
	struct page *page;

#ifdef CONFIG_CMA
	if (IS_ENABLED(CONFIG_CMA)) {
		/*
		 * Balance movable allocations between regular and CMA areas by
		 * allocating from CMA when over half of the zone's free memory
@@ -2873,9 +2873,9 @@ __rmqueue(struct zone *zone, unsigned int order, int migratetype,
		    zone_page_state(zone, NR_FREE_PAGES) / 2) {
			page = __rmqueue_cma_fallback(zone, order);
			if (page)
			return page;
				goto out;
		}
	}
#endif
retry:
	page = __rmqueue_smallest(zone, order, migratetype);
	if (unlikely(!page)) {
@@ -2886,7 +2886,8 @@ __rmqueue(struct zone *zone, unsigned int order, int migratetype,
								alloc_flags))
			goto retry;
	}

out:
	if (page)
		trace_mm_page_alloc_zone_locked(page, order, migratetype);
	return page;
}