linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ganesh Mahendran <opensource.ganesh@gmail.com>
To: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: akpm@linux-foundation.org, vbabka@suse.cz,
	iamjoonsoo.kim@lge.com, mhocko@suse.com, mina86@mina86.com,
	minchan@kernel.org, mgorman@techsingularity.net,
	rientjes@google.com, kirill.shutemov@linux.intel.com,
	izumi.taku@jp.fujitsu.com, hannes@cmpxchg.org,
	khandual@linux.vnet.ibm.com, bsingharora@gmail.com,
	Ganesh Mahendran <opensource.ganesh@gmail.com>
Subject: [PATCH v3] mm/compaction: remove unnecessary order check in direct compact path
Date: Thu, 16 Jun 2016 10:42:36 +0800	[thread overview]
Message-ID: <1466044956-3690-1-git-send-email-opensource.ganesh@gmail.com> (raw)

In direct compact path, both __alloc_pages_direct_compact and
try_to_compact_pages check (order == 0).

This patch removes the check in __alloc_pages_direct_compact() and
move the modifying of current->flags to the entry point of direct
page compaction where we really do the compaction.

Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
---
v2:
  remove the check in __alloc_pages_direct_compact - Anshuman Khandual
v3:
  remove check in __alloc_pages_direct_compact and move current->flags
  modifying to try_to_compact_pages
---
 mm/compaction.c | 7 ++++++-
 mm/page_alloc.c | 5 -----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index fbb7b38..dcfaf57 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1686,12 +1686,16 @@ enum compact_result try_to_compact_pages(gfp_t gfp_mask, unsigned int order,
 
 	*contended = COMPACT_CONTENDED_NONE;
 
-	/* Check if the GFP flags allow compaction */
+	/*
+	 * Check if this is an order-0 request and
+	 * if the GFP flags allow compaction.
+	 */
 	if (!order || !may_enter_fs || !may_perform_io)
 		return COMPACT_SKIPPED;
 
 	trace_mm_compaction_try_to_compact_pages(order, gfp_mask, mode);
 
+	current->flags |= PF_MEMALLOC;
 	/* Compact each zone in the list */
 	for_each_zone_zonelist_nodemask(zone, z, ac->zonelist, ac->high_zoneidx,
 								ac->nodemask) {
@@ -1768,6 +1772,7 @@ break_loop:
 		all_zones_contended = 0;
 		break;
 	}
+	current->flags &= ~PF_MEMALLOC;
 
 	/*
 	 * If at least one zone wasn't deferred or skipped, we report if all
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index b9ea618..dd3a2b6 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3173,13 +3173,8 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
 	struct page *page;
 	int contended_compaction;
 
-	if (!order)
-		return NULL;
-
-	current->flags |= PF_MEMALLOC;
 	*compact_result = try_to_compact_pages(gfp_mask, order, alloc_flags, ac,
 						mode, &contended_compaction);
-	current->flags &= ~PF_MEMALLOC;
 
 	if (*compact_result <= COMPACT_INACTIVE)
 		return NULL;
-- 
1.9.1

             reply	other threads:[~2016-06-16  2:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-16  2:42 Ganesh Mahendran [this message]
2016-06-16 10:17 ` [PATCH v3] mm/compaction: remove unnecessary order check in direct compact path Michal Hocko
2016-06-21  0:52 ` David Rientjes

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=1466044956-3690-1-git-send-email-opensource.ganesh@gmail.com \
    --to=opensource.ganesh@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bsingharora@gmail.com \
    --cc=hannes@cmpxchg.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=izumi.taku@jp.fujitsu.com \
    --cc=khandual@linux.vnet.ibm.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@suse.com \
    --cc=mina86@mina86.com \
    --cc=minchan@kernel.org \
    --cc=rientjes@google.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;
as well as URLs for NNTP newsgroup(s).