linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: zbestahu@aliyun.com
To: akpm@linux-foundation.org, vbabka@suse.cz,
	mgorman@techsingularity.net, mhocko@suse.com, hannes@cmpxchg.org,
	minchan@kernel.org
Cc: linux-mm@kvack.org, Yue Hu <huyue2@coolpad.com>
Subject: [PATCH] mm/page_alloc.c: improve allocation fast path
Date: Sat,  8 Jul 2017 09:28:39 +0800	[thread overview]
Message-ID: <1499477319-1395-1-git-send-email-zbestahu@aliyun.com> (raw)

From: Yue Hu <huyue2@coolpad.com>

We currently is taking time to check if the watermark is safe when
alloc_flags is setting with ALLOC_NO_WATERMARK in slowpath, the check
to alloc_flags is faster check which should be first check option
compared to the slow check of watermark, it could benefit to urgency
allocation request in slowpath, it also almost has no effect for
allocation with successful watermark check.

Signed-off-by: Yue Hu <huyue2@coolpad.com>
---
 mm/page_alloc.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 07efbc3..f1ba0e37 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3014,16 +3014,16 @@ static bool zone_allows_reclaim(struct zone *local_zone, struct zone *zone)
 			}
 		}
 
+		/* Checked here to keep the fast path fast */
+		BUILD_BUG_ON(ALLOC_NO_WATERMARKS < NR_WMARK);
+		if (alloc_flags & ALLOC_NO_WATERMARKS)
+			goto try_this_zone;
+
 		mark = zone->watermark[alloc_flags & ALLOC_WMARK_MASK];
 		if (!zone_watermark_fast(zone, order, mark,
 				       ac_classzone_idx(ac), alloc_flags)) {
 			int ret;
 
-			/* Checked here to keep the fast path fast */
-			BUILD_BUG_ON(ALLOC_NO_WATERMARKS < NR_WMARK);
-			if (alloc_flags & ALLOC_NO_WATERMARKS)
-				goto try_this_zone;
-
 			if (node_reclaim_mode == 0 ||
 			    !zone_allows_reclaim(ac->preferred_zoneref->zone, zone))
 				continue;
-- 
1.7.10.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

             reply	other threads:[~2017-07-08  1:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-08  1:28 zbestahu [this message]
2017-07-08 19:47 ` [PATCH] mm/page_alloc.c: improve allocation fast path Mel Gorman

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=1499477319-1395-1-git-send-email-zbestahu@aliyun.com \
    --to=zbestahu@aliyun.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=huyue2@coolpad.com \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@suse.com \
    --cc=minchan@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).