sched/numa: fix set cpupid on page migration twice against thp
Subsystems (4)
PATCH v3 1/12 sched/numa: fix set cpupid on page migration twice against thp
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.
--- mm/migrate.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
mm/migrate.c +0 -2
@@ -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);
Signature · 7 lines
1.7.5.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v3 2/12 sched/numa: drop idx field of task_numa_env struct
Drop unused idx field of task_numa_env struct.
--- kernel/sched/fair.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/sched/fair.c +1 -1
@@ -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;
Signature · 1 line
1.7.5.4
PATCH v3 3/12 sched/numa: drop sysctl_numa_balancing_settle_count sysctl
In reply to Wanpeng Licommit 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.
--- include/linux/sched/sysctl.h | 1 - kernel/sched/fair.c | 9 --------- kernel/sysctl.c | 7 ------- 3 files changed, 0 insertions(+), 17 deletions(-)
include/linux/sched/sysctl.h +0 -1
@@ -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;
kernel/sched/fair.c +0 -9
@@ -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 );
kernel/sysctl.c +0 -7
@@ -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),
Signature · 7 lines
1.7.5.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v3 4/12 sched/numa: use wrapper function task_node to get node which task is on
In reply to Wanpeng LiChangelog:
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.
--- kernel/sched/debug.c | 2 +- kernel/sched/fair.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
kernel/sched/debug.c +1 -1
@@ -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)));
kernel/sched/fair.c +2 -2
@@ -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 */
Signature · 7 lines
1.7.5.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v3 5/12 sched/numa: make numamigrate_isolate_page static
In reply to Wanpeng LiChangelog:
v2 -> v3:
* fix patch description
Make numamigrate_isolate_page static.
--- mm/migrate.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
mm/migrate.c +1 -1
@@ -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;
Signature · 7 lines
1.7.5.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v3 6/12 sched/numa: make numamigrate_update_ratelimit static
In reply to Wanpeng LiMake numamigrate_update_ratelimit static.
--- mm/migrate.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
mm/migrate.c +2 -1
@@ -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;
Signature · 7 lines
1.7.5.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v3 8/12 sched/numa: use wrapper function task_faults_idx to calculate index in group_faults
In reply to Wanpeng LiUse wrapper function task_faults_idx to calculate index in group_faults.
--- kernel/sched/fair.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
kernel/sched/fair.c +2 -1
@@ -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 )]; }/*
Signature · 7 lines
1.7.5.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v3 7/12 sched/numa: fix set cpupid on page migration twice against normal page
In reply to Wanpeng Licommit 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.
--- mm/migrate.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
mm/migrate.c +0 -2
@@ -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; }
Signature · 7 lines
1.7.5.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v3 9/12 sched/numa: fix task scan rate adjustment
In reply to Wanpeng Licommit 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.
--- kernel/sched/fair.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/sched/fair.c +1 -1
@@ -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,
Signature · 7 lines
1.7.5.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v3 10/12 sched/numa: fix record hinting faults check
In reply to Wanpeng LiAdjust 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.
--- kernel/sched/fair.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/sched/fair.c +1 -1
@@ -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 );
Signature · 7 lines
1.7.5.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v3 12/12 sched/numa: drop local 'ret' in task_numa_migrate()
In reply to Wanpeng Litask_numa_migrate() has two locals called "ret". Fix it all up.
--- kernel/sched/fair.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/sched/fair.c +1 -1
@@ -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; }
Signature · 1 line
1.7.5.4
PATCH v3 11/12 sched/numa: drop unnecessary variable in task_weight
In reply to Wanpeng LiDrop unnecessary total_faults variable in function task_weight to unify task_weight and group_weight.
--- kernel/sched/fair.c | 11 ++--------- 1 files changed, 2 insertions(+), 9 deletions(-)
kernel/sched/fair.c +2 -9
@@ -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)
Signature · 7 lines
1.7.5.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH v3 09/12] sched/numa: fix task scan rate adjustment
In reply to Wanpeng LiHi Wanpeng,
Quoted 14 lines · Wanpeng Li
commit
04bb2f947(sched/numa: Adjust scan rate intask_numa_placement) calculateperiod_slotwhich 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 <[email protected]>--- kernel/sched/fair.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)kernel/sched/fair.c +0
-0
kernel/sched/fair.c static void update_task_scan_period(struct task_struct *p, · line 1364
Quoted 8 lines
kernel/sched/fair.c +1
-1@@ -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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH v3 09/12] sched/numa: fix task scan rate adjustment
Hi Naoya,
Quoted 29 lines · Naoya Horiguchi
Hi Wanpeng,
Quoted 14 lines · Wanpeng Li
commit
04bb2f947(sched/numa: Adjust scan rate intask_numa_placement) calculateperiod_slotwhich 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 <[email protected]>--- kernel/sched/fair.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)kernel/sched/fair.c +0
-0kernel/sched/fair.c static void update_task_scan_period(struct task_struct *p, · line 1364
Quoted 8 lines
kernel/sched/fair.c +1
-1@@ -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:
Quoted 8 lines
diff = (diff calculated by local-remote ratio) * (private-shared ratio)
If you use
period_slothere, diff always becomes less then 1/10 finally by the second ratio multiplication (because we divide byNUMA_PERIOD_SLOTStwice), and I don't see the justification.And if my idea is correct, we don't have to recalculate
period_slotwhen 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 ?
Quoted 3 lines
Thanks,
Naoya Horiguchi
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH v3 10/12] sched/numa: fix record hinting faults check
In reply to Wanpeng LiQuoted 6 lines · Wanpeng Li
Adjust
numa_scan_periodintask_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 <[email protected]>
Looks good to me.
Quoted 26 lines
--- kernel/sched/fair.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)kernel/sched/fair.c +1
-1@@ -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 );Signature · 7 lines
1.7.5.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH v3 11/12] sched/numa: drop unnecessary variable in task_weight
In reply to Wanpeng LiQuoted 4 lines · Wanpeng Li
Drop unnecessary
total_faultsvariable in functiontask_weightto unifytask_weightandgroup_weight.Signed-off-by Wanpeng Li <[email protected]>
Quoted 31 lines
--- kernel/sched/fair.c | 11 ++--------- 1 files changed, 2 insertions(+), 9 deletions(-)kernel/sched/fair.c +2
-9@@ -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)Signature · 1 line
1.7.5.4
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH v3 12/12] sched/numa: drop local 'ret' in task_numa_migrate()
In reply to Wanpeng LiQuoted 3 lines · Wanpeng Li
task_numa_migrate()has two locals called "ret". Fix it all up.Signed-off-by Wanpeng Li <[email protected]>
Thanks!
Naoya
Quoted 20 lines
--- kernel/sched/fair.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)kernel/sched/fair.c +1
-1@@ -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; }Signature · 1 line
1.7.5.4
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH v3 12/12] sched/numa: drop local 'ret' in task_numa_migrate()
Hi Naoya,
Quoted 7 lines · Naoya Horiguchi
Quoted 3 lines · Wanpeng Li
task_numa_migrate()has two locals called "ret". Fix it all up.Signed-off-by Wanpeng Li <[email protected]>Reviewed-by Naoya Horiguchi <[email protected]>
How about patch7~8?
Regards,
Wanpeng Li
Quoted 20 lines
Thanks!
NaoyaQuoted 17 lines
--- kernel/sched/fair.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)kernel/sched/fair.c +1
-1@@ -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; }
Quoted 3 lines
Quoted 3 lines
Signature · 1 line
1.7.5.4
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Mel Gorman
reviewerRe: [PATCH v3 09/12] sched/numa: fix task scan rate adjustment
In reply to Naoya HoriguchiQuoted 24 lines · Naoya Horiguchi
Hi Wanpeng,
Quoted 21 lines · Wanpeng Li
commit
04bb2f947(sched/numa: Adjust scan rate intask_numa_placement) calculateperiod_slotwhich 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 <[email protected]>--- kernel/sched/fair.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)kernel/sched/fair.c +1
-1@@ -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 ; }
Quoted 7 lines
kernel/sched/fair.c static void update_task_scan_period(struct task_struct *p, · line 1364
Quoted 1 line
kernel/sched/fair.c +0
-0p->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.
Signature · 8 lines
Mel Gorman SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH v3 09/12] sched/numa: fix task scan rate adjustment
Quoted 30 lines · Mel Gorman
Quoted 29 lines · Naoya Horiguchi
Hi Wanpeng,
Quoted 14 lines · Wanpeng Li
commit
04bb2f947(sched/numa: Adjust scan rate intask_numa_placement) calculateperiod_slotwhich 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 <[email protected]>--- kernel/sched/fair.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)kernel/sched/fair.c +0
-0kernel/sched/fair.c static void update_task_scan_period(struct task_struct *p, · line 1364
Quoted 8 lines
kernel/sched/fair.c +1
-1@@ -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:
Quoted 9 lines
Quoted 2 lines
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_THRESHOLDand local/remote ratio when adjusting the scan period. Theperiod_slotrecalculation can be dropped.
Thanks Mel's pointing out. ;-)
Regards,
Wanpeng Li
Quoted 3 lines
Signature · 2 lines
Mel Gorman SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>