All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wu Fengguang <fengguang.wu@intel.com>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Rik van Riel <riel@redhat.com>
Subject: [PATCH] vmscan: aligned scan batching
Date: Sun, 6 Dec 2009 13:41:13 +0800	[thread overview]
Message-ID: <20091206054113.GA23912@localhost> (raw)
In-Reply-To: <20091127091357.A7CC.A69D9226@jp.fujitsu.com>

>  - pass nr_to_scan into isolate_pages() directly instead
>    using SWAP_CLUSTER_MAX

This patch will make sure nr_to_scan==SWAP_CLUSTER_MAX :)

Thanks,
Fengguang
---
vmscan: aligned scan batching

Make sure ->isolate_pages() always scans in unit of SWAP_CLUSTER_MAX.

CC: Rik van Riel <riel@redhat.com>
CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
 mm/vmscan.c |   20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

--- linux-mm.orig/mm/vmscan.c	2009-12-06 13:13:28.000000000 +0800
+++ linux-mm/mm/vmscan.c	2009-12-06 13:31:21.000000000 +0800
@@ -1572,15 +1572,11 @@ static void get_scan_ratio(struct zone *
 static unsigned long nr_scan_try_batch(unsigned long nr_to_scan,
 				       unsigned long *nr_saved_scan)
 {
-	unsigned long nr;
+	unsigned long nr = *nr_saved_scan + nr_to_scan;
+	unsigned long rem = nr & (SWAP_CLUSTER_MAX - 1);
 
-	*nr_saved_scan += nr_to_scan;
-	nr = *nr_saved_scan;
-
-	if (nr >= SWAP_CLUSTER_MAX)
-		*nr_saved_scan = 0;
-	else
-		nr = 0;
+	*nr_saved_scan = rem;
+	nr -= rem;
 
 	return nr;
 }
@@ -1592,7 +1588,6 @@ static void shrink_zone(int priority, st
 				struct scan_control *sc)
 {
 	unsigned long nr[NR_LRU_LISTS];
-	unsigned long nr_to_scan;
 	unsigned long percent[2];	/* anon @ 0; file @ 1 */
 	enum lru_list l;
 	unsigned long nr_reclaimed = sc->nr_reclaimed;
@@ -1625,11 +1620,8 @@ static void shrink_zone(int priority, st
 					nr[LRU_INACTIVE_FILE]) {
 		for_each_evictable_lru(l) {
 			if (nr[l]) {
-				nr_to_scan = min_t(unsigned long,
-						   nr[l], SWAP_CLUSTER_MAX);
-				nr[l] -= nr_to_scan;
-
-				nr_reclaimed += shrink_list(l, nr_to_scan,
+				nr[l] -= SWAP_CLUSTER_MAX;
+				nr_reclaimed += shrink_list(l, SWAP_CLUSTER_MAX,
 							    zone, sc, priority);
 			}
 		}

WARNING: multiple messages have this Message-ID (diff)
From: Wu Fengguang <fengguang.wu@intel.com>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Rik van Riel <riel@redhat.com>
Subject: [PATCH] vmscan: aligned scan batching
Date: Sun, 6 Dec 2009 13:41:13 +0800	[thread overview]
Message-ID: <20091206054113.GA23912@localhost> (raw)
In-Reply-To: <20091127091357.A7CC.A69D9226@jp.fujitsu.com>

>  - pass nr_to_scan into isolate_pages() directly instead
>    using SWAP_CLUSTER_MAX

This patch will make sure nr_to_scan==SWAP_CLUSTER_MAX :)

Thanks,
Fengguang
---
vmscan: aligned scan batching

Make sure ->isolate_pages() always scans in unit of SWAP_CLUSTER_MAX.

CC: Rik van Riel <riel@redhat.com>
CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
 mm/vmscan.c |   20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

--- linux-mm.orig/mm/vmscan.c	2009-12-06 13:13:28.000000000 +0800
+++ linux-mm/mm/vmscan.c	2009-12-06 13:31:21.000000000 +0800
@@ -1572,15 +1572,11 @@ static void get_scan_ratio(struct zone *
 static unsigned long nr_scan_try_batch(unsigned long nr_to_scan,
 				       unsigned long *nr_saved_scan)
 {
-	unsigned long nr;
+	unsigned long nr = *nr_saved_scan + nr_to_scan;
+	unsigned long rem = nr & (SWAP_CLUSTER_MAX - 1);
 
-	*nr_saved_scan += nr_to_scan;
-	nr = *nr_saved_scan;
-
-	if (nr >= SWAP_CLUSTER_MAX)
-		*nr_saved_scan = 0;
-	else
-		nr = 0;
+	*nr_saved_scan = rem;
+	nr -= rem;
 
 	return nr;
 }
@@ -1592,7 +1588,6 @@ static void shrink_zone(int priority, st
 				struct scan_control *sc)
 {
 	unsigned long nr[NR_LRU_LISTS];
-	unsigned long nr_to_scan;
 	unsigned long percent[2];	/* anon @ 0; file @ 1 */
 	enum lru_list l;
 	unsigned long nr_reclaimed = sc->nr_reclaimed;
@@ -1625,11 +1620,8 @@ static void shrink_zone(int priority, st
 					nr[LRU_INACTIVE_FILE]) {
 		for_each_evictable_lru(l) {
 			if (nr[l]) {
-				nr_to_scan = min_t(unsigned long,
-						   nr[l], SWAP_CLUSTER_MAX);
-				nr[l] -= nr_to_scan;
-
-				nr_reclaimed += shrink_list(l, nr_to_scan,
+				nr[l] -= SWAP_CLUSTER_MAX;
+				nr_reclaimed += shrink_list(l, SWAP_CLUSTER_MAX,
 							    zone, sc, priority);
 			}
 		}

--
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:[~2009-12-06  5:41 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-27  0:17 [PATCH 1/4] vmscan: more simplify shrink_inactive_list() KOSAKI Motohiro
2009-11-27  0:17 ` KOSAKI Motohiro
2009-11-27  0:18 ` [PATCH 2/4] vmscan: make lru_index() helper function KOSAKI Motohiro
2009-11-27  0:18   ` KOSAKI Motohiro
2009-11-27  5:44   ` Vincent Li
2009-11-27  5:44     ` Vincent Li
2009-11-27  5:47     ` KOSAKI Motohiro
2009-11-27  5:47       ` KOSAKI Motohiro
2009-11-27  5:54       ` Vincent Li
2009-11-27  5:54         ` Vincent Li
2009-11-27  0:19 ` [PATCH 3/4] vmscan: move PGDEACTIVATE modification to shrink_active_list() KOSAKI Motohiro
2009-11-27  0:19   ` KOSAKI Motohiro
2009-11-27  0:23 ` [RFC][PATCH 4/4] vmscan: vmscan don't use pcp list KOSAKI Motohiro
2009-11-27  0:23   ` KOSAKI Motohiro
2009-11-27 16:17   ` Mel Gorman
2009-11-27 16:17     ` Mel Gorman
2009-12-02  7:15     ` KOSAKI Motohiro
2009-12-02  7:15       ` KOSAKI Motohiro
2009-12-02 14:25       ` Mel Gorman
2009-12-02 14:25         ` Mel Gorman
2009-11-27 19:25   ` Christoph Lameter
2009-11-27 19:25     ` Christoph Lameter
2009-12-04  8:26 ` [PATCH 1/4] vmscan: more simplify shrink_inactive_list() KOSAKI Motohiro
2009-12-04  8:26   ` KOSAKI Motohiro
2009-12-06  4:19 ` Wu Fengguang
2009-12-06  4:19   ` Wu Fengguang
2009-12-07  5:48   ` KOSAKI Motohiro
2009-12-07  5:48     ` KOSAKI Motohiro
2009-12-06  5:41 ` Wu Fengguang [this message]
2009-12-06  5:41   ` [PATCH] vmscan: aligned scan batching Wu Fengguang
2009-12-07  6:17   ` KOSAKI Motohiro
2009-12-07  6:17     ` KOSAKI Motohiro

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=20091206054113.GA23912@localhost \
    --to=fengguang.wu@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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.