linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 01/12] sched/numa: fix set cpupid on page migration twice against thp
@ 2013-12-08  6:14 Wanpeng Li
  2013-12-08  6:14 ` [PATCH v3 02/12] sched/numa: drop idx field of task_numa_env struct Wanpeng Li
                   ` (10 more replies)
  0 siblings, 11 replies; 20+ messages in thread
From: Wanpeng Li @ 2013-12-08  6:14 UTC (permalink / raw)
  To: Andrew Morton, Ingo Molnar
  Cc: Rik van Riel, Mel Gorman, Peter Zijlstra, Naoya Horiguchi,
	linux-kernel, linux-mm, Wanpeng Li

commit 7851a45cd3 (mm: numa: Copy cpupid on page migration) copy over
the cpupid at page migration time, there is unnecessary to set it again
in function migrate_misplaced_transhuge_page, this patch fix it.

Acked-by: Mel Gorman <mgorman@suse.de>
Reviewed-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
---
 mm/migrate.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index bb94004..fdb70f7 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1736,8 +1736,6 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm,
 	if (!new_page)
 		goto out_fail;
 
-	page_cpupid_xchg_last(new_page, page_cpupid_last(page));
-
 	isolated = numamigrate_isolate_page(pgdat, page);
 	if (!isolated) {
 		put_page(new_page);
-- 
1.7.5.4

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

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v3 02/12] sched/numa: drop idx field of task_numa_env struct
  2013-12-08  6:14 [PATCH v3 01/12] sched/numa: fix set cpupid on page migration twice against thp Wanpeng Li
@ 2013-12-08  6:14 ` Wanpeng Li
  2013-12-08  6:14 ` [PATCH v3 03/12] sched/numa: drop sysctl_numa_balancing_settle_count sysctl Wanpeng Li
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: Wanpeng Li @ 2013-12-08  6:14 UTC (permalink / raw)
  To: Andrew Morton, Ingo Molnar
  Cc: Rik van Riel, Mel Gorman, Peter Zijlstra, Naoya Horiguchi,
	linux-kernel, linux-mm, Wanpeng Li

Drop unused idx field of task_numa_env struct.

Reviewed-by: Rik van Riel <riel@redhat.com>
Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
---
 kernel/sched/fair.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index fd773ad..ea3fd1e 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1037,7 +1037,7 @@ struct task_numa_env {
 
 	struct numa_stats src_stats, dst_stats;
 
-	int imbalance_pct, idx;
+	int imbalance_pct;
 
 	struct task_struct *best_task;
 	long best_imp;
-- 
1.7.5.4

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

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v3 03/12] sched/numa: drop sysctl_numa_balancing_settle_count sysctl
  2013-12-08  6:14 [PATCH v3 01/12] sched/numa: fix set cpupid on page migration twice against thp Wanpeng Li
  2013-12-08  6:14 ` [PATCH v3 02/12] sched/numa: drop idx field of task_numa_env struct Wanpeng Li
@ 2013-12-08  6:14 ` Wanpeng Li
  2013-12-08  6:14 ` [PATCH v3 04/12] sched/numa: use wrapper function task_node to get node which task is on Wanpeng Li
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: Wanpeng Li @ 2013-12-08  6:14 UTC (permalink / raw)
  To: Andrew Morton, Ingo Molnar
  Cc: Rik van Riel, Mel Gorman, Peter Zijlstra, Naoya Horiguchi,
	linux-kernel, linux-mm, Wanpeng Li

commit 887c290e (sched/numa: Decide whether to favour task or group weights
based on swap candidate relationships) drop the check against
sysctl_numa_balancing_settle_count, this patch remove the sysctl.

Acked-by: Mel Gorman <mgorman@suse.de>
Reviewed-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
---
 include/linux/sched/sysctl.h |    1 -
 kernel/sched/fair.c          |    9 ---------
 kernel/sysctl.c              |    7 -------
 3 files changed, 0 insertions(+), 17 deletions(-)

diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
index 41467f8..31e0193 100644
--- a/include/linux/sched/sysctl.h
+++ b/include/linux/sched/sysctl.h
@@ -48,7 +48,6 @@ extern unsigned int sysctl_numa_balancing_scan_delay;
 extern unsigned int sysctl_numa_balancing_scan_period_min;
 extern unsigned int sysctl_numa_balancing_scan_period_max;
 extern unsigned int sysctl_numa_balancing_scan_size;
-extern unsigned int sysctl_numa_balancing_settle_count;
 
 #ifdef CONFIG_SCHED_DEBUG
 extern unsigned int sysctl_sched_migration_cost;
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index ea3fd1e..56bcc0c 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -886,15 +886,6 @@ static unsigned int task_scan_max(struct task_struct *p)
 	return max(smin, smax);
 }
 
-/*
- * Once a preferred node is selected the scheduler balancer will prefer moving
- * a task to that node for sysctl_numa_balancing_settle_count number of PTE
- * scans. This will give the process the chance to accumulate more faults on
- * the preferred node but still allow the scheduler to move the task again if
- * the nodes CPUs are overloaded.
- */
-unsigned int sysctl_numa_balancing_settle_count __read_mostly = 4;
-
 static void account_numa_enqueue(struct rq *rq, struct task_struct *p)
 {
 	rq->nr_numa_running += (p->numa_preferred_nid != -1);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 34a6047..c8da99f 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -385,13 +385,6 @@ static struct ctl_table kern_table[] = {
 		.proc_handler	= proc_dointvec,
 	},
 	{
-		.procname       = "numa_balancing_settle_count",
-		.data           = &sysctl_numa_balancing_settle_count,
-		.maxlen         = sizeof(unsigned int),
-		.mode           = 0644,
-		.proc_handler   = proc_dointvec,
-	},
-	{
 		.procname       = "numa_balancing_migrate_deferred",
 		.data           = &sysctl_numa_balancing_migrate_deferred,
 		.maxlen         = sizeof(unsigned int),
-- 
1.7.5.4

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

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v3 04/12] sched/numa: use wrapper function task_node to get node which task is on
  2013-12-08  6:14 [PATCH v3 01/12] sched/numa: fix set cpupid on page migration twice against thp Wanpeng Li
  2013-12-08  6:14 ` [PATCH v3 02/12] sched/numa: drop idx field of task_numa_env struct Wanpeng Li
  2013-12-08  6:14 ` [PATCH v3 03/12] sched/numa: drop sysctl_numa_balancing_settle_count sysctl Wanpeng Li
@ 2013-12-08  6:14 ` Wanpeng Li
  2013-12-08  6:14 ` [PATCH v3 05/12] sched/numa: make numamigrate_isolate_page static Wanpeng Li
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: Wanpeng Li @ 2013-12-08  6:14 UTC (permalink / raw)
  To: Andrew Morton, Ingo Molnar
  Cc: Rik van Riel, Mel Gorman, Peter Zijlstra, Naoya Horiguchi,
	linux-kernel, linux-mm, Wanpeng Li

Changelog:
 v2 -> v3:
  * tranlate cpu_to_node(task_cpu(p)) to task_node(p) in sched/debug.c

Use wrapper function task_node to get node which task is on.

Acked-by: Mel Gorman <mgorman@suse.de>
Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Reviewed-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
---
 kernel/sched/debug.c |    2 +-
 kernel/sched/fair.c  |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index 5c34d18..374fe04 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -139,7 +139,7 @@ print_task(struct seq_file *m, struct rq *rq, struct task_struct *p)
 		0LL, 0LL, 0LL, 0L, 0LL, 0L, 0LL, 0L);
 #endif
 #ifdef CONFIG_NUMA_BALANCING
-	SEQ_printf(m, " %d", cpu_to_node(task_cpu(p)));
+	SEQ_printf(m, " %d", task_node(p));
 #endif
 #ifdef CONFIG_CGROUP_SCHED
 	SEQ_printf(m, " %s", task_group_path(task_group(p)));
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 56bcc0c..e0b1063 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1216,7 +1216,7 @@ static int task_numa_migrate(struct task_struct *p)
 	 * elsewhere, so there is no point in (re)trying.
 	 */
 	if (unlikely(!sd)) {
-		p->numa_preferred_nid = cpu_to_node(task_cpu(p));
+		p->numa_preferred_nid = task_node(p);
 		return -EINVAL;
 	}
 
@@ -1283,7 +1283,7 @@ static void numa_migrate_preferred(struct task_struct *p)
 	p->numa_migrate_retry = jiffies + HZ;
 
 	/* Success if task is already running on preferred CPU */
-	if (cpu_to_node(task_cpu(p)) == p->numa_preferred_nid)
+	if (task_node(p) == p->numa_preferred_nid)
 		return;
 
 	/* Otherwise, try migrate to a CPU on the preferred node */
-- 
1.7.5.4

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

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v3 05/12] sched/numa: make numamigrate_isolate_page static
  2013-12-08  6:14 [PATCH v3 01/12] sched/numa: fix set cpupid on page migration twice against thp Wanpeng Li
                   ` (2 preceding siblings ...)
  2013-12-08  6:14 ` [PATCH v3 04/12] sched/numa: use wrapper function task_node to get node which task is on Wanpeng Li
@ 2013-12-08  6:14 ` Wanpeng Li
  2013-12-08  6:14 ` [PATCH v3 06/12] sched/numa: make numamigrate_update_ratelimit static Wanpeng Li
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: Wanpeng Li @ 2013-12-08  6:14 UTC (permalink / raw)
  To: Andrew Morton, Ingo Molnar
  Cc: Rik van Riel, Mel Gorman, Peter Zijlstra, Naoya Horiguchi,
	linux-kernel, linux-mm, Wanpeng Li

Changelog:
 v2 -> v3:
  * fix patch description

Make numamigrate_isolate_page static.

Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
---
 mm/migrate.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index fdb70f7..7ad81e0 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1616,7 +1616,7 @@ bool numamigrate_update_ratelimit(pg_data_t *pgdat, unsigned long nr_pages)
 	return rate_limited;
 }
 
-int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page)
+static int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page)
 {
 	int page_lru;
 
-- 
1.7.5.4

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

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v3 06/12] sched/numa: make numamigrate_update_ratelimit static
  2013-12-08  6:14 [PATCH v3 01/12] sched/numa: fix set cpupid on page migration twice against thp Wanpeng Li
                   ` (3 preceding siblings ...)
  2013-12-08  6:14 ` [PATCH v3 05/12] sched/numa: make numamigrate_isolate_page static Wanpeng Li
@ 2013-12-08  6:14 ` Wanpeng Li
  2013-12-08  6:14 ` [PATCH v3 07/12] sched/numa: fix set cpupid on page migration twice against normal page Wanpeng Li
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: Wanpeng Li @ 2013-12-08  6:14 UTC (permalink / raw)
  To: Andrew Morton, Ingo Molnar
  Cc: Rik van Riel, Mel Gorman, Peter Zijlstra, Naoya Horiguchi,
	linux-kernel, linux-mm, Wanpeng Li

Make numamigrate_update_ratelimit static.

Reviewed-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
---
 mm/migrate.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index 7ad81e0..b1b6663 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1592,7 +1592,8 @@ bool migrate_ratelimited(int node)
 }
 
 /* Returns true if the node is migrate rate-limited after the update */
-bool numamigrate_update_ratelimit(pg_data_t *pgdat, unsigned long nr_pages)
+static bool numamigrate_update_ratelimit(pg_data_t *pgdat,
+						unsigned long nr_pages)
 {
 	bool rate_limited = false;
 
-- 
1.7.5.4

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

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v3 07/12] sched/numa: fix set cpupid on page migration twice against normal page
  2013-12-08  6:14 [PATCH v3 01/12] sched/numa: fix set cpupid on page migration twice against thp Wanpeng Li
                   ` (4 preceding siblings ...)
  2013-12-08  6:14 ` [PATCH v3 06/12] sched/numa: make numamigrate_update_ratelimit static Wanpeng Li
@ 2013-12-08  6:14 ` Wanpeng Li
  2013-12-08  6:14 ` [PATCH v3 08/12] sched/numa: use wrapper function task_faults_idx to calculate index in group_faults Wanpeng Li
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: Wanpeng Li @ 2013-12-08  6:14 UTC (permalink / raw)
  To: Andrew Morton, Ingo Molnar
  Cc: Rik van Riel, Mel Gorman, Peter Zijlstra, Naoya Horiguchi,
	linux-kernel, linux-mm, Wanpeng Li

commit 7851a45cd3 (mm: numa: Copy cpupid on page migration) copy over
the cpupid at page migration time, there is unnecessary to set it again
in function alloc_misplaced_dst_page, this patch fix it.

Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
---
 mm/migrate.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index b1b6663..508cde4 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1557,8 +1557,6 @@ static struct page *alloc_misplaced_dst_page(struct page *page,
 					  __GFP_NOMEMALLOC | __GFP_NORETRY |
 					  __GFP_NOWARN) &
 					 ~GFP_IOFS, 0);
-	if (newpage)
-		page_cpupid_xchg_last(newpage, page_cpupid_last(page));
 
 	return newpage;
 }
-- 
1.7.5.4

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

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v3 08/12] sched/numa: use wrapper function task_faults_idx to calculate index in group_faults
  2013-12-08  6:14 [PATCH v3 01/12] sched/numa: fix set cpupid on page migration twice against thp Wanpeng Li
                   ` (5 preceding siblings ...)
  2013-12-08  6:14 ` [PATCH v3 07/12] sched/numa: fix set cpupid on page migration twice against normal page Wanpeng Li
@ 2013-12-08  6:14 ` Wanpeng Li
  2013-12-08  6:14 ` [PATCH v3 09/12] sched/numa: fix task scan rate adjustment Wanpeng Li
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: Wanpeng Li @ 2013-12-08  6:14 UTC (permalink / raw)
  To: Andrew Morton, Ingo Molnar
  Cc: Rik van Riel, Mel Gorman, Peter Zijlstra, Naoya Horiguchi,
	linux-kernel, linux-mm, Wanpeng Li

Use wrapper function task_faults_idx to calculate index in group_faults.

Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
---
 kernel/sched/fair.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index e0b1063..7073c76 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -935,7 +935,8 @@ static inline unsigned long group_faults(struct task_struct *p, int nid)
 	if (!p->numa_group)
 		return 0;
 
-	return p->numa_group->faults[2*nid] + p->numa_group->faults[2*nid+1];
+	return p->numa_group->faults[task_faults_idx(nid, 0)] +
+		p->numa_group->faults[task_faults_idx(nid, 1)];
 }
 
 /*
-- 
1.7.5.4

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

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v3 09/12] sched/numa: fix task scan rate adjustment
  2013-12-08  6:14 [PATCH v3 01/12] sched/numa: fix set cpupid on page migration twice against thp Wanpeng Li
                   ` (6 preceding siblings ...)
  2013-12-08  6:14 ` [PATCH v3 08/12] sched/numa: use wrapper function task_faults_idx to calculate index in group_faults Wanpeng Li
@ 2013-12-08  6:14 ` Wanpeng Li
  2013-12-10  6:44   ` Naoya Horiguchi
  2013-12-08  6:14 ` [PATCH v3 10/12] sched/numa: fix record hinting faults check Wanpeng Li
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 20+ messages in thread
From: Wanpeng Li @ 2013-12-08  6:14 UTC (permalink / raw)
  To: Andrew Morton, Ingo Molnar
  Cc: Rik van Riel, Mel Gorman, Peter Zijlstra, Naoya Horiguchi,
	linux-kernel, linux-mm, Wanpeng Li

commit 04bb2f947 (sched/numa: Adjust scan rate in task_numa_placement) calculate
period_slot which should be used as base value of scan rate increase if remote
access dominate. However, current codes forget to use it, this patch fix it.

Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
---
 kernel/sched/fair.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 7073c76..b077f1b3 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1358,7 +1358,7 @@ static void update_task_scan_period(struct task_struct *p,
 		 */
 		period_slot = DIV_ROUND_UP(diff, NUMA_PERIOD_SLOTS);
 		ratio = DIV_ROUND_UP(private * NUMA_PERIOD_SLOTS, (private + shared));
-		diff = (diff * ratio) / NUMA_PERIOD_SLOTS;
+		diff = (period_slot * ratio) / NUMA_PERIOD_SLOTS;
 	}
 
 	p->numa_scan_period = clamp(p->numa_scan_period + diff,
-- 
1.7.5.4

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

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v3 10/12] sched/numa: fix record hinting faults check
  2013-12-08  6:14 [PATCH v3 01/12] sched/numa: fix set cpupid on page migration twice against thp Wanpeng Li
                   ` (7 preceding siblings ...)
  2013-12-08  6:14 ` [PATCH v3 09/12] sched/numa: fix task scan rate adjustment Wanpeng Li
@ 2013-12-08  6:14 ` Wanpeng Li
  2013-12-10  7:01   ` Naoya Horiguchi
  2013-12-08  6:14 ` [PATCH v3 11/12] sched/numa: drop unnecessary variable in task_weight Wanpeng Li
  2013-12-08  6:14 ` [PATCH v3 12/12] sched/numa: drop local 'ret' in task_numa_migrate() Wanpeng Li
  10 siblings, 1 reply; 20+ messages in thread
From: Wanpeng Li @ 2013-12-08  6:14 UTC (permalink / raw)
  To: Andrew Morton, Ingo Molnar
  Cc: Rik van Riel, Mel Gorman, Peter Zijlstra, Naoya Horiguchi,
	linux-kernel, linux-mm, Wanpeng Li

Adjust numa_scan_period in task_numa_placement, depending on how much useful
work the numa code can do. The local faults and remote faults should be used
to check if there is record hinting faults instead of local faults and shared
faults. This patch fix it.

Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
---
 kernel/sched/fair.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index b077f1b3..942e67b 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1322,7 +1322,7 @@ static void update_task_scan_period(struct task_struct *p,
 	 * completely idle or all activity is areas that are not of interest
 	 * to automatic numa balancing. Scan slower
 	 */
-	if (local + shared == 0) {
+	if (local + remote == 0) {
 		p->numa_scan_period = min(p->numa_scan_period_max,
 			p->numa_scan_period << 1);
 
-- 
1.7.5.4

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

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v3 11/12] sched/numa: drop unnecessary variable in task_weight
  2013-12-08  6:14 [PATCH v3 01/12] sched/numa: fix set cpupid on page migration twice against thp Wanpeng Li
                   ` (8 preceding siblings ...)
  2013-12-08  6:14 ` [PATCH v3 10/12] sched/numa: fix record hinting faults check Wanpeng Li
@ 2013-12-08  6:14 ` Wanpeng Li
  2013-12-10  7:11   ` Naoya Horiguchi
  2013-12-08  6:14 ` [PATCH v3 12/12] sched/numa: drop local 'ret' in task_numa_migrate() Wanpeng Li
  10 siblings, 1 reply; 20+ messages in thread
From: Wanpeng Li @ 2013-12-08  6:14 UTC (permalink / raw)
  To: Andrew Morton, Ingo Molnar
  Cc: Rik van Riel, Mel Gorman, Peter Zijlstra, Naoya Horiguchi,
	linux-kernel, linux-mm, Wanpeng Li

Drop unnecessary total_faults variable in function task_weight to unify
task_weight and group_weight.

Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
---
 kernel/sched/fair.c |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 942e67b..df8b677 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -947,17 +947,10 @@ static inline unsigned long group_faults(struct task_struct *p, int nid)
  */
 static inline unsigned long task_weight(struct task_struct *p, int nid)
 {
-	unsigned long total_faults;
-
-	if (!p->numa_faults)
-		return 0;
-
-	total_faults = p->total_numa_faults;
-
-	if (!total_faults)
+	if (!p->numa_faults || !p->total_numa_faults)
 		return 0;
 
-	return 1000 * task_faults(p, nid) / total_faults;
+	return 1000 * task_faults(p, nid) / p->total_numa_faults;
 }
 
 static inline unsigned long group_weight(struct task_struct *p, int nid)
-- 
1.7.5.4

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

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v3 12/12] sched/numa: drop local 'ret' in task_numa_migrate()
  2013-12-08  6:14 [PATCH v3 01/12] sched/numa: fix set cpupid on page migration twice against thp Wanpeng Li
                   ` (9 preceding siblings ...)
  2013-12-08  6:14 ` [PATCH v3 11/12] sched/numa: drop unnecessary variable in task_weight Wanpeng Li
@ 2013-12-08  6:14 ` Wanpeng Li
  2013-12-10  7:12   ` Naoya Horiguchi
  10 siblings, 1 reply; 20+ messages in thread
From: Wanpeng Li @ 2013-12-08  6:14 UTC (permalink / raw)
  To: Andrew Morton, Ingo Molnar
  Cc: Rik van Riel, Mel Gorman, Peter Zijlstra, Naoya Horiguchi,
	linux-kernel, linux-mm, Wanpeng Li

task_numa_migrate() has two locals called "ret". Fix it all up.

Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
---
 kernel/sched/fair.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index df8b677..3159ca7 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1257,7 +1257,7 @@ static int task_numa_migrate(struct task_struct *p)
 	p->numa_scan_period = task_scan_min(p);
 
 	if (env.best_task == NULL) {
-		int ret = migrate_task_to(p, env.best_cpu);
+		ret = migrate_task_to(p, env.best_cpu);
 		return ret;
 	}
 
-- 
1.7.5.4

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

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH v3 09/12] sched/numa: fix task scan rate adjustment
  2013-12-08  6:14 ` [PATCH v3 09/12] sched/numa: fix task scan rate adjustment Wanpeng Li
@ 2013-12-10  6:44   ` Naoya Horiguchi
  2013-12-10  6:51     ` Wanpeng Li
  2013-12-10  8:27     ` Mel Gorman
  0 siblings, 2 replies; 20+ messages in thread
From: Naoya Horiguchi @ 2013-12-10  6:44 UTC (permalink / raw)
  To: Wanpeng Li
  Cc: Andrew Morton, Ingo Molnar, Rik van Riel, Mel Gorman,
	Peter Zijlstra, linux-kernel, linux-mm

Hi Wanpeng,

On Sun, Dec 08, 2013 at 02:14:50PM +0800, Wanpeng Li wrote:
> commit 04bb2f947 (sched/numa: Adjust scan rate in task_numa_placement) calculate
> period_slot which should be used as base value of scan rate increase if remote
> access dominate. However, current codes forget to use it, this patch fix it.
> 
> Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
> ---
>  kernel/sched/fair.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 7073c76..b077f1b3 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -1358,7 +1358,7 @@ static void update_task_scan_period(struct task_struct *p,
>  		 */
>  		period_slot = DIV_ROUND_UP(diff, NUMA_PERIOD_SLOTS);
>  		ratio = DIV_ROUND_UP(private * NUMA_PERIOD_SLOTS, (private + shared));
> -		diff = (diff * ratio) / NUMA_PERIOD_SLOTS;
> +		diff = (period_slot * ratio) / NUMA_PERIOD_SLOTS;
>  	}
>  
>  	p->numa_scan_period = clamp(p->numa_scan_period + diff,

It seems to me that the original code is correct, because the mathematical
meaning of this hunk is clear:

  diff = (diff calculated by local-remote ratio) * (private-shared ratio)

If you use period_slot here, diff always becomes less then 1/10 finally by
the second ratio multiplication (because we divide by NUMA_PERIOD_SLOTS twice),
and I don't see the justification.

And if my idea is correct, we don't have to recalculate period_slot when
we multiply private-shared ratio. So we can remove that line.

Thanks,
Naoya Horiguchi

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v3 09/12] sched/numa: fix task scan rate adjustment
  2013-12-10  6:44   ` Naoya Horiguchi
@ 2013-12-10  6:51     ` Wanpeng Li
  2013-12-10  8:27     ` Mel Gorman
  1 sibling, 0 replies; 20+ messages in thread
From: Wanpeng Li @ 2013-12-10  6:51 UTC (permalink / raw)
  To: Naoya Horiguchi
  Cc: Andrew Morton, Ingo Molnar, Rik van Riel, Mel Gorman,
	Peter Zijlstra, linux-kernel, linux-mm

Hi Naoya,
On Tue, Dec 10, 2013 at 01:44:35AM -0500, Naoya Horiguchi wrote:
>Hi Wanpeng,
>
>On Sun, Dec 08, 2013 at 02:14:50PM +0800, Wanpeng Li wrote:
>> commit 04bb2f947 (sched/numa: Adjust scan rate in task_numa_placement) calculate
>> period_slot which should be used as base value of scan rate increase if remote
>> access dominate. However, current codes forget to use it, this patch fix it.
>> 
>> Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
>> ---
>>  kernel/sched/fair.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>> 
>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>> index 7073c76..b077f1b3 100644
>> --- a/kernel/sched/fair.c
>> +++ b/kernel/sched/fair.c
>> @@ -1358,7 +1358,7 @@ static void update_task_scan_period(struct task_struct *p,
>>  		 */
>>  		period_slot = DIV_ROUND_UP(diff, NUMA_PERIOD_SLOTS);
>>  		ratio = DIV_ROUND_UP(private * NUMA_PERIOD_SLOTS, (private + shared));
>> -		diff = (diff * ratio) / NUMA_PERIOD_SLOTS;
>> +		diff = (period_slot * ratio) / NUMA_PERIOD_SLOTS;
>>  	}
>>  
>>  	p->numa_scan_period = clamp(p->numa_scan_period + diff,
>
>It seems to me that the original code is correct, because the mathematical
>meaning of this hunk is clear:
>
>  diff = (diff calculated by local-remote ratio) * (private-shared ratio)
>
>If you use period_slot here, diff always becomes less then 1/10 finally by
>the second ratio multiplication (because we divide by NUMA_PERIOD_SLOTS twice),
>and I don't see the justification.
>
>And if my idea is correct, we don't have to recalculate period_slot when
>we multiply private-shared ratio. So we can remove that line.

Thanks for your review. I agree with you when I first review this codes.
It introduced by commit 04bb2f94 (sched/numa: Adjust scan rate in 
task_numa_placement), what's your original target, Rik ?

>
>Thanks,
>Naoya Horiguchi

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v3 10/12] sched/numa: fix record hinting faults check
  2013-12-08  6:14 ` [PATCH v3 10/12] sched/numa: fix record hinting faults check Wanpeng Li
@ 2013-12-10  7:01   ` Naoya Horiguchi
  0 siblings, 0 replies; 20+ messages in thread
From: Naoya Horiguchi @ 2013-12-10  7:01 UTC (permalink / raw)
  To: Wanpeng Li
  Cc: Andrew Morton, Ingo Molnar, Rik van Riel, Mel Gorman,
	Peter Zijlstra, linux-kernel, linux-mm

On Sun, Dec 08, 2013 at 02:14:51PM +0800, Wanpeng Li wrote:
> Adjust numa_scan_period in task_numa_placement, depending on how much useful
> work the numa code can do. The local faults and remote faults should be used
> to check if there is record hinting faults instead of local faults and shared
> faults. This patch fix it.
> 
> Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>

Looks good to me.

Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

> ---
>  kernel/sched/fair.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index b077f1b3..942e67b 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -1322,7 +1322,7 @@ static void update_task_scan_period(struct task_struct *p,
>  	 * completely idle or all activity is areas that are not of interest
>  	 * to automatic numa balancing. Scan slower
>  	 */
> -	if (local + shared == 0) {
> +	if (local + remote == 0) {
>  		p->numa_scan_period = min(p->numa_scan_period_max,
>  			p->numa_scan_period << 1);
>  
> -- 
> 1.7.5.4
> 
> --
> 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>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v3 11/12] sched/numa: drop unnecessary variable in task_weight
  2013-12-08  6:14 ` [PATCH v3 11/12] sched/numa: drop unnecessary variable in task_weight Wanpeng Li
@ 2013-12-10  7:11   ` Naoya Horiguchi
  0 siblings, 0 replies; 20+ messages in thread
From: Naoya Horiguchi @ 2013-12-10  7:11 UTC (permalink / raw)
  To: Wanpeng Li
  Cc: Andrew Morton, Ingo Molnar, Rik van Riel, Mel Gorman,
	Peter Zijlstra, linux-kernel, linux-mm

On Sun, Dec 08, 2013 at 02:14:52PM +0800, Wanpeng Li wrote:
> Drop unnecessary total_faults variable in function task_weight to unify
> task_weight and group_weight.
> 
> Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>

Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

> ---
>  kernel/sched/fair.c |   11 ++---------
>  1 files changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 942e67b..df8b677 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -947,17 +947,10 @@ static inline unsigned long group_faults(struct task_struct *p, int nid)
>   */
>  static inline unsigned long task_weight(struct task_struct *p, int nid)
>  {
> -	unsigned long total_faults;
> -
> -	if (!p->numa_faults)
> -		return 0;
> -
> -	total_faults = p->total_numa_faults;
> -
> -	if (!total_faults)
> +	if (!p->numa_faults || !p->total_numa_faults)
>  		return 0;
>  
> -	return 1000 * task_faults(p, nid) / total_faults;
> +	return 1000 * task_faults(p, nid) / p->total_numa_faults;
>  }
>  
>  static inline unsigned long group_weight(struct task_struct *p, int nid)
> -- 
> 1.7.5.4
> 

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v3 12/12] sched/numa: drop local 'ret' in task_numa_migrate()
  2013-12-08  6:14 ` [PATCH v3 12/12] sched/numa: drop local 'ret' in task_numa_migrate() Wanpeng Li
@ 2013-12-10  7:12   ` Naoya Horiguchi
  2013-12-10  7:17     ` Wanpeng Li
  0 siblings, 1 reply; 20+ messages in thread
From: Naoya Horiguchi @ 2013-12-10  7:12 UTC (permalink / raw)
  To: Wanpeng Li
  Cc: Andrew Morton, Ingo Molnar, Rik van Riel, Mel Gorman,
	Peter Zijlstra, linux-kernel, linux-mm

On Sun, Dec 08, 2013 at 02:14:53PM +0800, Wanpeng Li wrote:
> task_numa_migrate() has two locals called "ret". Fix it all up.
> 
> Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>

Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

Thanks!
Naoya

> ---
>  kernel/sched/fair.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index df8b677..3159ca7 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -1257,7 +1257,7 @@ static int task_numa_migrate(struct task_struct *p)
>  	p->numa_scan_period = task_scan_min(p);
>  
>  	if (env.best_task == NULL) {
> -		int ret = migrate_task_to(p, env.best_cpu);
> +		ret = migrate_task_to(p, env.best_cpu);
>  		return ret;
>  	}
>  
> -- 
> 1.7.5.4
> 

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v3 12/12] sched/numa: drop local 'ret' in task_numa_migrate()
  2013-12-10  7:12   ` Naoya Horiguchi
@ 2013-12-10  7:17     ` Wanpeng Li
  0 siblings, 0 replies; 20+ messages in thread
From: Wanpeng Li @ 2013-12-10  7:17 UTC (permalink / raw)
  To: Naoya Horiguchi
  Cc: Andrew Morton, Ingo Molnar, Rik van Riel, Mel Gorman,
	Peter Zijlstra, linux-kernel, linux-mm

Hi Naoya,
On Tue, Dec 10, 2013 at 02:12:47AM -0500, Naoya Horiguchi wrote:
>On Sun, Dec 08, 2013 at 02:14:53PM +0800, Wanpeng Li wrote:
>> task_numa_migrate() has two locals called "ret". Fix it all up.
>> 
>> Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
>
>Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
>

How about patch7~8? 

Regards,
Wanpeng Li 

>Thanks!
>Naoya
>
>> ---
>>  kernel/sched/fair.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>> 
>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>> index df8b677..3159ca7 100644
>> --- a/kernel/sched/fair.c
>> +++ b/kernel/sched/fair.c
>> @@ -1257,7 +1257,7 @@ static int task_numa_migrate(struct task_struct *p)
>>  	p->numa_scan_period = task_scan_min(p);
>>  
>>  	if (env.best_task == NULL) {
>> -		int ret = migrate_task_to(p, env.best_cpu);
>> +		ret = migrate_task_to(p, env.best_cpu);
>>  		return ret;
>>  	}
>>  
>> -- 
>> 1.7.5.4
>> 

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v3 09/12] sched/numa: fix task scan rate adjustment
  2013-12-10  6:44   ` Naoya Horiguchi
  2013-12-10  6:51     ` Wanpeng Li
@ 2013-12-10  8:27     ` Mel Gorman
  2013-12-10  8:49       ` Wanpeng Li
  1 sibling, 1 reply; 20+ messages in thread
From: Mel Gorman @ 2013-12-10  8:27 UTC (permalink / raw)
  To: Naoya Horiguchi
  Cc: Wanpeng Li, Andrew Morton, Ingo Molnar, Rik van Riel,
	Peter Zijlstra, linux-kernel, linux-mm

On Tue, Dec 10, 2013 at 01:44:35AM -0500, Naoya Horiguchi wrote:
> Hi Wanpeng,
> 
> On Sun, Dec 08, 2013 at 02:14:50PM +0800, Wanpeng Li wrote:
> > commit 04bb2f947 (sched/numa: Adjust scan rate in task_numa_placement) calculate
> > period_slot which should be used as base value of scan rate increase if remote
> > access dominate. However, current codes forget to use it, this patch fix it.
> > 
> > Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
> > ---
> >  kernel/sched/fair.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 7073c76..b077f1b3 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -1358,7 +1358,7 @@ static void update_task_scan_period(struct task_struct *p,
> >  		 */
> >  		period_slot = DIV_ROUND_UP(diff, NUMA_PERIOD_SLOTS);
> >  		ratio = DIV_ROUND_UP(private * NUMA_PERIOD_SLOTS, (private + shared));
> > -		diff = (diff * ratio) / NUMA_PERIOD_SLOTS;
> > +		diff = (period_slot * ratio) / NUMA_PERIOD_SLOTS;
> >  	}
> >  
> >  	p->numa_scan_period = clamp(p->numa_scan_period + diff,
> 
> It seems to me that the original code is correct, because the mathematical
> meaning of this hunk is clear:
> 
>   diff = (diff calculated by local-remote ratio) * (private-shared ratio)
> 

Thanks Naoya.

The original code is as intended and was meant to scale the difference
between the NUMA_PERIOD_THRESHOLD and local/remote ratio when adjusting
the scan period. The period_slot recalculation can be dropped.

-- 
Mel Gorman
SUSE Labs

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v3 09/12] sched/numa: fix task scan rate adjustment
  2013-12-10  8:27     ` Mel Gorman
@ 2013-12-10  8:49       ` Wanpeng Li
  0 siblings, 0 replies; 20+ messages in thread
From: Wanpeng Li @ 2013-12-10  8:49 UTC (permalink / raw)
  To: Mel Gorman
  Cc: Naoya Horiguchi, Andrew Morton, Ingo Molnar, Rik van Riel,
	Peter Zijlstra, linux-kernel, linux-mm

On Tue, Dec 10, 2013 at 08:27:59AM +0000, Mel Gorman wrote:
>On Tue, Dec 10, 2013 at 01:44:35AM -0500, Naoya Horiguchi wrote:
>> Hi Wanpeng,
>> 
>> On Sun, Dec 08, 2013 at 02:14:50PM +0800, Wanpeng Li wrote:
>> > commit 04bb2f947 (sched/numa: Adjust scan rate in task_numa_placement) calculate
>> > period_slot which should be used as base value of scan rate increase if remote
>> > access dominate. However, current codes forget to use it, this patch fix it.
>> > 
>> > Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
>> > ---
>> >  kernel/sched/fair.c |    2 +-
>> >  1 files changed, 1 insertions(+), 1 deletions(-)
>> > 
>> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>> > index 7073c76..b077f1b3 100644
>> > --- a/kernel/sched/fair.c
>> > +++ b/kernel/sched/fair.c
>> > @@ -1358,7 +1358,7 @@ static void update_task_scan_period(struct task_struct *p,
>> >  		 */
>> >  		period_slot = DIV_ROUND_UP(diff, NUMA_PERIOD_SLOTS);
>> >  		ratio = DIV_ROUND_UP(private * NUMA_PERIOD_SLOTS, (private + shared));
>> > -		diff = (diff * ratio) / NUMA_PERIOD_SLOTS;
>> > +		diff = (period_slot * ratio) / NUMA_PERIOD_SLOTS;
>> >  	}
>> >  
>> >  	p->numa_scan_period = clamp(p->numa_scan_period + diff,
>> 
>> It seems to me that the original code is correct, because the mathematical
>> meaning of this hunk is clear:
>> 
>>   diff = (diff calculated by local-remote ratio) * (private-shared ratio)
>> 
>
>Thanks Naoya.
>
>The original code is as intended and was meant to scale the difference
>between the NUMA_PERIOD_THRESHOLD and local/remote ratio when adjusting
>the scan period. The period_slot recalculation can be dropped.
>

Thanks Mel's pointing out. ;-)

Regards,
Wanpeng Li 

>-- 
>Mel Gorman
>SUSE Labs

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2013-12-10  8:49 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-08  6:14 [PATCH v3 01/12] sched/numa: fix set cpupid on page migration twice against thp Wanpeng Li
2013-12-08  6:14 ` [PATCH v3 02/12] sched/numa: drop idx field of task_numa_env struct Wanpeng Li
2013-12-08  6:14 ` [PATCH v3 03/12] sched/numa: drop sysctl_numa_balancing_settle_count sysctl Wanpeng Li
2013-12-08  6:14 ` [PATCH v3 04/12] sched/numa: use wrapper function task_node to get node which task is on Wanpeng Li
2013-12-08  6:14 ` [PATCH v3 05/12] sched/numa: make numamigrate_isolate_page static Wanpeng Li
2013-12-08  6:14 ` [PATCH v3 06/12] sched/numa: make numamigrate_update_ratelimit static Wanpeng Li
2013-12-08  6:14 ` [PATCH v3 07/12] sched/numa: fix set cpupid on page migration twice against normal page Wanpeng Li
2013-12-08  6:14 ` [PATCH v3 08/12] sched/numa: use wrapper function task_faults_idx to calculate index in group_faults Wanpeng Li
2013-12-08  6:14 ` [PATCH v3 09/12] sched/numa: fix task scan rate adjustment Wanpeng Li
2013-12-10  6:44   ` Naoya Horiguchi
2013-12-10  6:51     ` Wanpeng Li
2013-12-10  8:27     ` Mel Gorman
2013-12-10  8:49       ` Wanpeng Li
2013-12-08  6:14 ` [PATCH v3 10/12] sched/numa: fix record hinting faults check Wanpeng Li
2013-12-10  7:01   ` Naoya Horiguchi
2013-12-08  6:14 ` [PATCH v3 11/12] sched/numa: drop unnecessary variable in task_weight Wanpeng Li
2013-12-10  7:11   ` Naoya Horiguchi
2013-12-08  6:14 ` [PATCH v3 12/12] sched/numa: drop local 'ret' in task_numa_migrate() Wanpeng Li
2013-12-10  7:12   ` Naoya Horiguchi
2013-12-10  7:17     ` Wanpeng Li

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