提交 8c9cf8f7 编写于 作者: H Hailong liu 提交者: Zheng Zengkai

mm/page_alloc: add a missing mm_page_alloc_zone_locked() tracepoint

stable inclusion
from stable-5.10.12
commit c11f7749f1fc9bad6b1f0e073de08fa996f21cc3
bugzilla: 47876

--------------------------------

commit ce8f86ee upstream.

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.comSigned-off-by: NHailong liu <liu.hailong6@zte.com.cn>
Reviewed-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
Cc: Ivan Babrou <ivan@cloudflare.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 5aa82478
...@@ -2844,20 +2844,20 @@ __rmqueue(struct zone *zone, unsigned int order, int migratetype, ...@@ -2844,20 +2844,20 @@ __rmqueue(struct zone *zone, unsigned int order, int migratetype,
{ {
struct page *page; struct page *page;
#ifdef CONFIG_CMA if (IS_ENABLED(CONFIG_CMA)) {
/* /*
* Balance movable allocations between regular and CMA areas by * Balance movable allocations between regular and CMA areas by
* allocating from CMA when over half of the zone's free memory * allocating from CMA when over half of the zone's free memory
* is in the CMA area. * is in the CMA area.
*/ */
if (alloc_flags & ALLOC_CMA && if (alloc_flags & ALLOC_CMA &&
zone_page_state(zone, NR_FREE_CMA_PAGES) > zone_page_state(zone, NR_FREE_CMA_PAGES) >
zone_page_state(zone, NR_FREE_PAGES) / 2) { zone_page_state(zone, NR_FREE_PAGES) / 2) {
page = __rmqueue_cma_fallback(zone, order); page = __rmqueue_cma_fallback(zone, order);
if (page) if (page)
return page; goto out;
}
} }
#endif
retry: retry:
page = __rmqueue_smallest(zone, order, migratetype); page = __rmqueue_smallest(zone, order, migratetype);
if (unlikely(!page)) { if (unlikely(!page)) {
...@@ -2868,8 +2868,9 @@ __rmqueue(struct zone *zone, unsigned int order, int migratetype, ...@@ -2868,8 +2868,9 @@ __rmqueue(struct zone *zone, unsigned int order, int migratetype,
alloc_flags)) alloc_flags))
goto retry; goto retry;
} }
out:
trace_mm_page_alloc_zone_locked(page, order, migratetype); if (page)
trace_mm_page_alloc_zone_locked(page, order, migratetype);
return page; return page;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册