From: Andrew Morton <akpm@linux-foundation.org>
To: Rik van Riel <riel@redhat.com>
Cc: linux-mm@kvack.org, lkml <linux-kernel@vger.kernel.org>,
Andrea Arcangeli <aarcange@redhat.com>,
Mel Gorman <mel@csn.ul.ie>, Johannes Weiner <hannes@cmpxchg.org>,
Minchan Kim <minchan.kim@gmail.com>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Subject: Re: [PATCH v3 -mm 2/3] mm: kswapd carefully call compaction
Date: Fri, 27 Jan 2012 15:36:28 -0800 [thread overview]
Message-ID: <20120127153628.53f04f7d.akpm@linux-foundation.org> (raw)
In-Reply-To: <20120126145958.4c37ea04@cuia.bos.redhat.com>
On Thu, 26 Jan 2012 14:59:58 -0500
Rik van Riel <riel@redhat.com> wrote:
> With CONFIG_COMPACTION enabled, kswapd does not try to free
> contiguous free pages, even when it is woken for a higher order
> request.
>
> This could be bad for eg. jumbo frame network allocations, which
> are done from interrupt context and cannot compact memory themselves.
> Higher than before allocation failure rates in the network receive
> path have been observed in kernels with compaction enabled.
>
> Teach kswapd to defragment the memory zones in a node, but only
> if required and compaction is not deferred in a zone.
>
> ...
>
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -2673,6 +2673,7 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order,
> int priority;
> int i;
> int end_zone = 0; /* Inclusive. 0 = ZONE_DMA */
> + int zones_need_compaction = 1;
> unsigned long total_scanned;
> struct reclaim_state *reclaim_state = current->reclaim_state;
> unsigned long nr_soft_reclaimed;
> @@ -2937,9 +2938,17 @@ out:
> goto loop_again;
> }
>
> + /* Check if the memory needs to be defragmented. */
> + if (zone_watermark_ok(zone, order,
> + low_wmark_pages(zone), *classzone_idx, 0))
> + zones_need_compaction = 0;
> +
> /* If balanced, clear the congested flag */
> zone_clear_flag(zone, ZONE_CONGESTED);
> }
> +
> + if (zones_need_compaction)
> + compact_pgdat(pgdat, order);
> }
Nicer:
From: Andrew Morton <akpm@linux-foundation.org>
Subject: vmscan-kswapd-carefully-call-compaction-fix
reduce scope of zones_need_compaction
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Hillf Danton <dhillf@gmail.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Minchan Kim <minchan.kim@gmail.com>
Cc: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/vmscan.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/mm/vmscan.c~vmscan-kswapd-carefully-call-compaction-fix
+++ a/mm/vmscan.c
@@ -2672,7 +2672,6 @@ static unsigned long balance_pgdat(pg_da
int priority;
int i;
int end_zone = 0; /* Inclusive. 0 = ZONE_DMA */
- int zones_need_compaction = 1;
unsigned long total_scanned;
struct reclaim_state *reclaim_state = current->reclaim_state;
unsigned long nr_soft_reclaimed;
@@ -2920,6 +2919,8 @@ out:
* and it is potentially going to sleep here.
*/
if (order) {
+ int zones_need_compaction = 1;
+
for (i = 0; i <= end_zone; i++) {
struct zone *zone = pgdat->node_zones + i;
_
(could have given it type "bool", but that seems unnecessary when it
has "needs" in the name)
next prev parent reply other threads:[~2012-01-27 23:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-26 19:54 [PATCH v3 -mm 0/3] kswapd vs compaction improvements Rik van Riel
2012-01-26 19:59 ` [PATCH v3 -mm 1/3] mm: reclaim at order 0 when compaction is enabled Rik van Riel
2012-01-27 9:13 ` Hillf Danton
2012-01-27 16:35 ` Rik van Riel
2012-01-30 10:26 ` Mel Gorman
2012-01-27 23:31 ` Andrew Morton
2012-01-29 13:25 ` Hillf Danton
2012-01-30 10:36 ` Mel Gorman
2012-01-26 19:59 ` [PATCH v3 -mm 2/3] mm: kswapd carefully call compaction Rik van Riel
2012-01-27 23:36 ` Andrew Morton [this message]
2012-01-26 20:01 ` [PATCH v3 -mm 3/3] mm: only defer compaction for failed order and higher Rik van Riel
2012-01-30 10:47 ` 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=20120127153628.53f04f7d.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=aarcange@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mel@csn.ul.ie \
--cc=minchan.kim@gmail.com \
--cc=riel@redhat.com \
/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).