linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Wanpeng Li <liwanp@linux.vnet.ibm.com>
To: Andrea Arcangeli <aarcange@redhat.com>
Cc: linux-mm@kvack.org, Mel Gorman <mgorman@suse.de>,
	Rik van Riel <riel@redhat.com>, Hugh Dickins <hughd@google.com>,
	Richard Davies <richard@arachsys.com>,
	Shaohua Li <shli@kernel.org>, Rafael Aquini <aquini@redhat.com>,
	Hush Bensen <hush.bensen@gmail.com>
Subject: Re: [PATCH 03/10] mm: zone_reclaim: compaction: don't depend on kswapd to invoke reset_isolation_suitable
Date: Wed, 17 Jul 2013 07:32:57 +0800	[thread overview]
Message-ID: <20130716233257.GC30164@hacker.(null)> (raw)
In-Reply-To: <1373982114-19774-4-git-send-email-aarcange@redhat.com>

On Tue, Jul 16, 2013 at 03:41:47PM +0200, Andrea Arcangeli wrote:
>If kswapd never need to run (only __GFP_NO_KSWAPD allocations and
>plenty of free memory) compaction is otherwise crippled down and stops
>running for a while after the free/isolation cursor meets. After that
>allocation can fail for a full cycle of compaction_deferred, until
>compaction_restarting finally reset it again.
>
>Stopping compaction for a full cycle after the cursor meets, even if
>it never failed and it's not going to fail, doesn't make sense.
>
>We already throttle compaction CPU utilization using
>defer_compaction. We shouldn't prevent compaction to run after each
>pass completes when the cursor meets, unless it failed.
>
>This makes direct compaction functional again. The throttling of
>direct compaction is still controlled by the defer_compaction
>logic.
>
>kswapd still won't risk to reset compaction, and it will wait direct
>compaction to do so. Not sure if this is ideal but it at least
>decreases the risk of kswapd doing too much work. kswapd will only run
>one pass of compaction until some allocation invokes compaction again.
>
>This decreased reliability of compaction was introduced in commit
>62997027ca5b3d4618198ed8b1aba40b61b1137b .
>
>Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
>Reviewed-by: Rik van Riel <riel@redhat.com>
>Acked-by: Rafael Aquini <aquini@redhat.com>
>Acked-by: Mel Gorman <mgorman@suse.de>

Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>

>---
> include/linux/compaction.h |  5 -----
> include/linux/mmzone.h     |  3 ---
> mm/compaction.c            | 15 ++++++---------
> mm/page_alloc.c            |  1 -
> mm/vmscan.c                |  8 --------
> 5 files changed, 6 insertions(+), 26 deletions(-)
>
>diff --git a/include/linux/compaction.h b/include/linux/compaction.h
>index 091d72e..fc3f266 100644
>--- a/include/linux/compaction.h
>+++ b/include/linux/compaction.h
>@@ -24,7 +24,6 @@ extern unsigned long try_to_compact_pages(struct zonelist *zonelist,
> 			int order, gfp_t gfp_mask, nodemask_t *mask,
> 			bool sync, bool *contended);
> extern void compact_pgdat(pg_data_t *pgdat, int order);
>-extern void reset_isolation_suitable(pg_data_t *pgdat);
> extern unsigned long compaction_suitable(struct zone *zone, int order);
>
> /* Do not skip compaction more than 64 times */
>@@ -84,10 +83,6 @@ static inline void compact_pgdat(pg_data_t *pgdat, int order)
> {
> }
>
>-static inline void reset_isolation_suitable(pg_data_t *pgdat)
>-{
>-}
>-
> static inline unsigned long compaction_suitable(struct zone *zone, int order)
> {
> 	return COMPACT_SKIPPED;
>diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
>index 9534a9a..e738871 100644
>--- a/include/linux/mmzone.h
>+++ b/include/linux/mmzone.h
>@@ -354,9 +354,6 @@ struct zone {
> 	spinlock_t		lock;
> 	int                     all_unreclaimable; /* All pages pinned */
> #if defined CONFIG_COMPACTION || defined CONFIG_CMA
>-	/* Set to true when the PG_migrate_skip bits should be cleared */
>-	bool			compact_blockskip_flush;
>-
> 	/* pfns where compaction scanners should start */
> 	unsigned long		compact_cached_free_pfn;
> 	unsigned long		compact_cached_migrate_pfn;
>diff --git a/mm/compaction.c b/mm/compaction.c
>index cac9594..525baaa 100644
>--- a/mm/compaction.c
>+++ b/mm/compaction.c
>@@ -91,7 +91,6 @@ static void __reset_isolation_suitable(struct zone *zone)
>
> 	zone->compact_cached_migrate_pfn = start_pfn;
> 	zone->compact_cached_free_pfn = end_pfn;
>-	zone->compact_blockskip_flush = false;
>
> 	/* Walk the zone and mark every pageblock as suitable for isolation */
> 	for (pfn = start_pfn; pfn < end_pfn; pfn += pageblock_nr_pages) {
>@@ -110,7 +109,7 @@ static void __reset_isolation_suitable(struct zone *zone)
> 	}
> }
>
>-void reset_isolation_suitable(pg_data_t *pgdat)
>+static void reset_isolation_suitable(pg_data_t *pgdat)
> {
> 	int zoneid;
>
>@@ -120,8 +119,7 @@ void reset_isolation_suitable(pg_data_t *pgdat)
> 			continue;
>
> 		/* Only flush if a full compaction finished recently */
>-		if (zone->compact_blockskip_flush)
>-			__reset_isolation_suitable(zone);
>+		__reset_isolation_suitable(zone);
> 	}
> }
>
>@@ -828,13 +826,12 @@ static int compact_finished(struct zone *zone,
> 	/* Compaction run completes if the migrate and free scanner meet */
> 	if (cc->free_pfn <= cc->migrate_pfn) {
> 		/*
>-		 * Mark that the PG_migrate_skip information should be cleared
>-		 * by kswapd when it goes to sleep. kswapd does not set the
>-		 * flag itself as the decision to be clear should be directly
>-		 * based on an allocation request.
>+		 * Clear the PG_migrate_skip information. kswapd does
>+		 * not clear it as the decision to be clear should be
>+		 * directly based on an allocation request.
> 		 */
> 		if (!current_is_kswapd())
>-			zone->compact_blockskip_flush = true;
>+			__reset_isolation_suitable(zone);
>
> 		return COMPACT_COMPLETE;
> 	}
>diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>index b100255..db8fb66 100644
>--- a/mm/page_alloc.c
>+++ b/mm/page_alloc.c
>@@ -2190,7 +2190,6 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
> 				alloc_flags & ~ALLOC_NO_WATERMARKS,
> 				preferred_zone, migratetype);
> 		if (page) {
>-			preferred_zone->compact_blockskip_flush = false;
> 			preferred_zone->compact_considered = 0;
> 			preferred_zone->compact_defer_shift = 0;
> 			if (order >= preferred_zone->compact_order_failed)
>diff --git a/mm/vmscan.c b/mm/vmscan.c
>index 042fdcd..85a0071 100644
>--- a/mm/vmscan.c
>+++ b/mm/vmscan.c
>@@ -3091,14 +3091,6 @@ static void kswapd_try_to_sleep(pg_data_t *pgdat, int order, int classzone_idx)
> 		 */
> 		set_pgdat_percpu_threshold(pgdat, calculate_normal_threshold);
>
>-		/*
>-		 * Compaction records what page blocks it recently failed to
>-		 * isolate pages from and skips them in the future scanning.
>-		 * When kswapd is going to sleep, it is reasonable to assume
>-		 * that pages and compaction may succeed so reset the cache.
>-		 */
>-		reset_isolation_suitable(pgdat);
>-
> 		if (!kthread_should_stop())
> 			schedule();
>
>
>--
>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>

--
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:[~2013-07-16 23:33 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-16 13:41 [PATCH 00/10] adding compaction to zone_reclaim_mode > 0 #2 Andrea Arcangeli
2013-07-16 13:41 ` [PATCH 01/10] mm: zone_reclaim: remove ZONE_RECLAIM_LOCKED Andrea Arcangeli
2013-07-16 23:45   ` Wanpeng Li
2013-07-16 23:45   ` Wanpeng Li
2013-07-16 13:41 ` [PATCH 02/10] mm: zone_reclaim: compaction: scan all memory with /proc/sys/vm/compact_memory Andrea Arcangeli
2013-07-16 23:29   ` Wanpeng Li
2013-07-16 23:29   ` Wanpeng Li
2013-07-16 13:41 ` [PATCH 03/10] mm: zone_reclaim: compaction: don't depend on kswapd to invoke reset_isolation_suitable Andrea Arcangeli
2013-07-16 23:32   ` Wanpeng Li [this message]
2013-07-16 23:32   ` Wanpeng Li
2013-07-16 13:41 ` [PATCH 04/10] mm: zone_reclaim: compaction: reset before initializing the scan cursors Andrea Arcangeli
2013-07-16 23:31   ` Wanpeng Li
2013-07-16 23:31   ` Wanpeng Li
2013-07-16 13:41 ` [PATCH 05/10] mm: compaction: don't require high order pages below min wmark Andrea Arcangeli
2013-07-17  8:13   ` Hush Bensen
2013-07-17 17:15     ` Andrea Arcangeli
2013-07-16 13:41 ` [PATCH 06/10] mm: zone_reclaim: compaction: increase the high order pages in the watermarks Andrea Arcangeli
2013-07-16 13:41 ` [PATCH 07/10] mm: zone_reclaim: compaction: export compact_zone_order() Andrea Arcangeli
2013-07-16 13:41 ` [PATCH 08/10] mm: zone_reclaim: only run zone_reclaim in the fast path Andrea Arcangeli
2013-07-16 13:41 ` [PATCH 09/10] mm: zone_reclaim: after a successful zone_reclaim check the min watermark Andrea Arcangeli
2013-07-16 13:41 ` [PATCH 10/10] mm: zone_reclaim: compaction: add compaction to zone_reclaim_mode Andrea Arcangeli
2013-07-17  8:20   ` Hush Bensen
2013-07-17 17:20     ` Andrea Arcangeli

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='20130716233257.GC30164@hacker.(null)' \
    --to=liwanp@linux.vnet.ibm.com \
    --cc=aarcange@redhat.com \
    --cc=aquini@redhat.com \
    --cc=hughd@google.com \
    --cc=hush.bensen@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=richard@arachsys.com \
    --cc=riel@redhat.com \
    --cc=shli@kernel.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