All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mel Gorman <mgorman@suse.de>
To: Linux-MM <linux-mm@kvack.org>
Cc: Rik van Riel <riel@redhat.com>, Minchan Kim <minchan@kernel.org>,
	Jim Schutt <jaschut@sandia.gov>,
	LKML <linux-kernel@vger.kernel.org>, Mel Gorman <mgorman@suse.de>
Subject: [PATCH 3/6] mm: kswapd: Continue reclaiming for reclaim/compaction if the minimum number of pages have not been reclaimed
Date: Tue,  7 Aug 2012 13:31:14 +0100	[thread overview]
Message-ID: <1344342677-5845-4-git-send-email-mgorman@suse.de> (raw)
In-Reply-To: <1344342677-5845-1-git-send-email-mgorman@suse.de>

When direct reclaim is running reclaim/compaction, there is a minimum
number of pages it reclaims. As it must be under the low watermark to be
in direct reclaim it has also woken kswapd to do some work. This patch
has kswapd use the same logic as direct reclaim to reclaim a minimum
number of pages so compaction can run later.

Signed-off-by: Mel Gorman <mgorman@suse.de>
---
 mm/vmscan.c |   19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 0cb2593..afdec93 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1701,7 +1701,7 @@ static bool in_reclaim_compaction(struct scan_control *sc)
  * calls try_to_compact_zone() that it will have enough free pages to succeed.
  * It will give up earlier than that if there is difficulty reclaiming pages.
  */
-static inline bool should_continue_reclaim(struct lruvec *lruvec,
+static bool should_continue_reclaim(struct lruvec *lruvec,
 					unsigned long nr_reclaimed,
 					unsigned long nr_scanned,
 					struct scan_control *sc)
@@ -1768,6 +1768,17 @@ static inline bool should_continue_reclaim(struct lruvec *lruvec,
 	}
 }
 
+static inline bool should_continue_reclaim_zone(struct zone *zone,
+					unsigned long nr_reclaimed,
+					unsigned long nr_scanned,
+					struct scan_control *sc)
+{
+	struct mem_cgroup *memcg = mem_cgroup_iter(NULL, NULL, NULL);
+	struct lruvec *lruvec = mem_cgroup_zone_lruvec(zone, memcg);
+
+	return should_continue_reclaim(lruvec, nr_reclaimed, nr_scanned, sc);
+}
+
 /*
  * This is a basic per-zone page freer.  Used by both kswapd and direct reclaim.
  */
@@ -2496,8 +2507,10 @@ loop_again:
 			 */
 			testorder = order;
 			if (COMPACTION_BUILD && order &&
-					compaction_suitable(zone, order) !=
-						COMPACT_SKIPPED)
+					!should_continue_reclaim_zone(zone,
+						nr_soft_reclaimed,
+						sc.nr_scanned - nr_soft_scanned,
+						&sc))
 				testorder = 0;
 
 			if ((buffer_heads_over_limit && is_highmem_idx(i)) ||
-- 
1.7.9.2


WARNING: multiple messages have this Message-ID (diff)
From: Mel Gorman <mgorman@suse.de>
To: Linux-MM <linux-mm@kvack.org>
Cc: Rik van Riel <riel@redhat.com>, Minchan Kim <minchan@kernel.org>,
	Jim Schutt <jaschut@sandia.gov>,
	LKML <linux-kernel@vger.kernel.org>, Mel Gorman <mgorman@suse.de>
Subject: [PATCH 3/6] mm: kswapd: Continue reclaiming for reclaim/compaction if the minimum number of pages have not been reclaimed
Date: Tue,  7 Aug 2012 13:31:14 +0100	[thread overview]
Message-ID: <1344342677-5845-4-git-send-email-mgorman@suse.de> (raw)
In-Reply-To: <1344342677-5845-1-git-send-email-mgorman@suse.de>

When direct reclaim is running reclaim/compaction, there is a minimum
number of pages it reclaims. As it must be under the low watermark to be
in direct reclaim it has also woken kswapd to do some work. This patch
has kswapd use the same logic as direct reclaim to reclaim a minimum
number of pages so compaction can run later.

Signed-off-by: Mel Gorman <mgorman@suse.de>
---
 mm/vmscan.c |   19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 0cb2593..afdec93 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1701,7 +1701,7 @@ static bool in_reclaim_compaction(struct scan_control *sc)
  * calls try_to_compact_zone() that it will have enough free pages to succeed.
  * It will give up earlier than that if there is difficulty reclaiming pages.
  */
-static inline bool should_continue_reclaim(struct lruvec *lruvec,
+static bool should_continue_reclaim(struct lruvec *lruvec,
 					unsigned long nr_reclaimed,
 					unsigned long nr_scanned,
 					struct scan_control *sc)
@@ -1768,6 +1768,17 @@ static inline bool should_continue_reclaim(struct lruvec *lruvec,
 	}
 }
 
+static inline bool should_continue_reclaim_zone(struct zone *zone,
+					unsigned long nr_reclaimed,
+					unsigned long nr_scanned,
+					struct scan_control *sc)
+{
+	struct mem_cgroup *memcg = mem_cgroup_iter(NULL, NULL, NULL);
+	struct lruvec *lruvec = mem_cgroup_zone_lruvec(zone, memcg);
+
+	return should_continue_reclaim(lruvec, nr_reclaimed, nr_scanned, sc);
+}
+
 /*
  * This is a basic per-zone page freer.  Used by both kswapd and direct reclaim.
  */
@@ -2496,8 +2507,10 @@ loop_again:
 			 */
 			testorder = order;
 			if (COMPACTION_BUILD && order &&
-					compaction_suitable(zone, order) !=
-						COMPACT_SKIPPED)
+					!should_continue_reclaim_zone(zone,
+						nr_soft_reclaimed,
+						sc.nr_scanned - nr_soft_scanned,
+						&sc))
 				testorder = 0;
 
 			if ((buffer_heads_over_limit && is_highmem_idx(i)) ||
-- 
1.7.9.2

--
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>

  parent reply	other threads:[~2012-08-07 12:32 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-07 12:31 [RFC PATCH 0/6] Improve hugepage allocation success rates under load Mel Gorman
2012-08-07 12:31 ` Mel Gorman
2012-08-07 12:31 ` [PATCH 1/6] mm: compaction: Update comment in try_to_compact_pages Mel Gorman
2012-08-07 12:31   ` Mel Gorman
2012-08-07 13:19   ` Rik van Riel
2012-08-07 13:19     ` Rik van Riel
2012-08-07 23:25   ` Minchan Kim
2012-08-07 23:25     ` Minchan Kim
2012-08-07 12:31 ` [PATCH 2/6] mm: vmscan: Scale number of pages reclaimed by reclaim/compaction based on failures Mel Gorman
2012-08-07 12:31   ` Mel Gorman
2012-08-07 13:23   ` Rik van Riel
2012-08-07 13:23     ` Rik van Riel
2012-08-08  1:48   ` Minchan Kim
2012-08-08  1:48     ` Minchan Kim
2012-08-08  7:55     ` Mel Gorman
2012-08-08  7:55       ` Mel Gorman
2012-08-08  8:27       ` Minchan Kim
2012-08-08  8:27         ` Minchan Kim
2012-08-08  8:51         ` Mel Gorman
2012-08-08  8:51           ` Mel Gorman
2012-08-08 23:51           ` Minchan Kim
2012-08-08 23:51             ` Minchan Kim
2012-08-09  7:49             ` Mel Gorman
2012-08-09  7:49               ` Mel Gorman
2012-08-09  8:27               ` Minchan Kim
2012-08-09  8:27                 ` Minchan Kim
2012-08-09  9:20                 ` Mel Gorman
2012-08-09  9:20                   ` Mel Gorman
2012-08-09 20:29                   ` Rik van Riel
2012-08-09 20:29                     ` Rik van Riel
2012-08-10  8:14                     ` Mel Gorman
2012-08-10  8:14                       ` Mel Gorman
2012-08-09 23:27                   ` Minchan Kim
2012-08-09 23:27                     ` Minchan Kim
2012-08-10  8:34                     ` Mel Gorman
2012-08-10  8:34                       ` Mel Gorman
2012-08-10  8:48                       ` Minchan Kim
2012-08-10  8:48                         ` Minchan Kim
2012-08-07 12:31 ` Mel Gorman [this message]
2012-08-07 12:31   ` [PATCH 3/6] mm: kswapd: Continue reclaiming for reclaim/compaction if the minimum number of pages have not been reclaimed Mel Gorman
2012-08-07 13:26   ` Rik van Riel
2012-08-07 13:26     ` Rik van Riel
2012-08-08  2:07   ` Minchan Kim
2012-08-08  2:07     ` Minchan Kim
2012-08-08  9:07     ` Mel Gorman
2012-08-08  9:07       ` Mel Gorman
2012-08-08  9:58       ` Mel Gorman
2012-08-08  9:58         ` Mel Gorman
2012-08-07 12:31 ` [PATCH 4/6] mm: compaction: Capture a suitable high-order page immediately when it is made available Mel Gorman
2012-08-07 12:31   ` Mel Gorman
2012-08-07 13:30   ` Rik van Riel
2012-08-07 13:30     ` Rik van Riel
2012-08-07 12:31 ` [PATCH 5/6] mm: have order > 0 compaction start off where it left Mel Gorman
2012-08-07 12:31   ` Mel Gorman
2012-08-07 12:31 ` [PATCH 6/6] mm: have order > 0 compaction start near a pageblock with free pages Mel Gorman
2012-08-07 12:31   ` Mel Gorman
2012-08-07 14:45   ` Rik van Riel
2012-08-07 14:45     ` Rik van Riel
2012-08-07 14:52     ` Mel Gorman
2012-08-07 14:52       ` Mel Gorman
2012-08-07 15:20       ` Jim Schutt
2012-08-07 15:20         ` Jim Schutt
2012-08-07 15:45         ` Mel Gorman
2012-08-07 15:45           ` Mel Gorman
2012-08-08  4:36   ` Minchan Kim
2012-08-08  4:36     ` Minchan Kim
2012-08-08 10:18     ` Mel Gorman
2012-08-08 10:18       ` 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=1344342677-5845-4-git-send-email-mgorman@suse.de \
    --to=mgorman@suse.de \
    --cc=jaschut@sandia.gov \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.