linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: akpm@linux-foundation.org, linux-mm@kvack.org,
	liu.hailong6@zte.com.cn, mm-commits@vger.kernel.org,
	torvalds@linux-foundation.org
Subject: [patch 02/10] mm/page_alloc: add a missing mm_page_alloc_zone_locked() tracepoint
Date: Tue, 12 Jan 2021 15:49:08 -0800	[thread overview]
Message-ID: <20210112234908.xc2cFVP-8%akpm@linux-foundation.org> (raw)
In-Reply-To: <20210112154839.abeb6e57de79480059fd9b0e@linux-foundation.org>

From: Hailong liu <liu.hailong6@zte.com.cn>
Subject: 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: Hailong liu <liu.hailong6@zte.com.cn>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/page_alloc.c |   31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

--- a/mm/page_alloc.c~mm-page_alloc-add-a-missing-mm_page_alloc_zone_locked-tracepoint
+++ a/mm/page_alloc.c
@@ -2862,20 +2862,20 @@ __rmqueue(struct zone *zone, unsigned in
 {
 	struct page *page;
 
-#ifdef CONFIG_CMA
-	/*
-	 * Balance movable allocations between regular and CMA areas by
-	 * allocating from CMA when over half of the zone's free memory
-	 * is in the CMA area.
-	 */
-	if (alloc_flags & ALLOC_CMA &&
-	    zone_page_state(zone, NR_FREE_CMA_PAGES) >
-	    zone_page_state(zone, NR_FREE_PAGES) / 2) {
-		page = __rmqueue_cma_fallback(zone, order);
-		if (page)
-			return page;
+	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
+		 * is in the CMA area.
+		 */
+		if (alloc_flags & ALLOC_CMA &&
+		    zone_page_state(zone, NR_FREE_CMA_PAGES) >
+		    zone_page_state(zone, NR_FREE_PAGES) / 2) {
+			page = __rmqueue_cma_fallback(zone, order);
+			if (page)
+				goto out;
+		}
 	}
-#endif
 retry:
 	page = __rmqueue_smallest(zone, order, migratetype);
 	if (unlikely(!page)) {
@@ -2886,8 +2886,9 @@ retry:
 								alloc_flags))
 			goto retry;
 	}
-
-	trace_mm_page_alloc_zone_locked(page, order, migratetype);
+out:
+	if (page)
+		trace_mm_page_alloc_zone_locked(page, order, migratetype);
 	return page;
 }
 
_


  parent reply	other threads:[~2021-01-12 23:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-12 23:48 incoming Andrew Morton
2021-01-12 23:49 ` [patch 01/10] mm, slub: consider rest of partial list if acquire_slab() fails Andrew Morton
2021-01-12 23:49 ` Andrew Morton [this message]
2021-01-12 23:49 ` [patch 03/10] mm/memcontrol: fix warning in mem_cgroup_page_lruvec() Andrew Morton
2021-01-12 23:49 ` [patch 04/10] arm/kasan: fix the array size of kasan_early_shadow_pte[] Andrew Morton
2021-01-12 23:49 ` [patch 05/10] mm/vmalloc.c: fix potential memory leak Andrew Morton
2021-01-12 23:49 ` [patch 06/10] mm: migrate: initialize err in do_migrate_pages Andrew Morton
2021-01-12 23:49 ` [patch 07/10] mm/hugetlb: fix potential missing huge page size info Andrew Morton
2021-01-12 23:49 ` [patch 08/10] MAINTAINERS: add Vlastimil as slab allocators maintainer Andrew Morton
2021-01-12 23:49 ` [patch 09/10] mm,hwpoison: fix printing of page flags Andrew Morton
2021-01-12 23:49 ` [patch 10/10] mm/process_vm_access.c: include compat.h Andrew Morton
2021-01-15 23:32 ` incoming Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210112234908.xc2cFVP-8%akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=liu.hailong6@zte.com.cn \
    --cc=mm-commits@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).