linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Pengfei Li <lpf.vector@gmail.com>
To: akpm@linux-foundation.org
Cc: mhocko@suse.com, vbabka@suse.cz, osalvador@suse.de,
	pavel.tatashin@microsoft.com, mgorman@techsingularity.net,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Pengfei Li <lpf.vector@gmail.com>
Subject: [PATCH] mm/page_alloc: cleanup __alloc_pages_direct_compact()
Date: Sat, 17 Aug 2019 18:51:02 +0800	[thread overview]
Message-ID: <20190817105102.11732-1-lpf.vector@gmail.com> (raw)

This patch cleans up the if(page).

No functional change.

Signed-off-by: Pengfei Li <lpf.vector@gmail.com>
---
 mm/page_alloc.c | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 272c6de1bf4e..51f056ac09f5 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3890,6 +3890,7 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
 		enum compact_priority prio, enum compact_result *compact_result)
 {
 	struct page *page = NULL;
+	struct zone *zone;
 	unsigned long pflags;
 	unsigned int noreclaim_flag;
 
@@ -3911,23 +3912,26 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
 	 */
 	count_vm_event(COMPACTSTALL);
 
-	/* Prep a captured page if available */
-	if (page)
+	if (page) {
+		/* Prep a captured page if available */
 		prep_new_page(page, order, gfp_mask, alloc_flags);
-
-	/* Try get a page from the freelist if available */
-	if (!page)
+	} else {
+		/* Try get a page from the freelist if available */
 		page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac);
 
-	if (page) {
-		struct zone *zone = page_zone(page);
-
-		zone->compact_blockskip_flush = false;
-		compaction_defer_reset(zone, order, true);
-		count_vm_event(COMPACTSUCCESS);
-		return page;
+		if (!page)
+			goto failed;
 	}
 
+	zone = page_zone(page);
+	zone->compact_blockskip_flush = false;
+	compaction_defer_reset(zone, order, true);
+
+	count_vm_event(COMPACTSUCCESS);
+
+	return page;
+
+failed:
 	/*
 	 * It's bad if compaction run occurs and fails. The most likely reason
 	 * is that pages exist, but not enough to satisfy watermarks.
-- 
2.21.0



             reply	other threads:[~2019-08-17 10:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-17 10:51 Pengfei Li [this message]
2019-08-19 13:50 ` Vlastimil Babka
2019-08-19 15:29   ` Pengfei Li

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=20190817105102.11732-1-lpf.vector@gmail.com \
    --to=lpf.vector@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@suse.com \
    --cc=osalvador@suse.de \
    --cc=pavel.tatashin@microsoft.com \
    --cc=vbabka@suse.cz \
    /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