linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] sched/numa: fix bug in update_task_scan_period
@ 2020-08-11  8:30 丁天琛
  2020-08-11 11:01 ` Mel Gorman
  0 siblings, 1 reply; 4+ messages in thread
From: 丁天琛 @ 2020-08-11  8:30 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	linux-kernel
  Cc: 王贇

When p->numa_faults_locality[2] > 0, numa_scan_period is doubled, but
this array will never be cleared, which causes scanning period always
reaching its max value. This patch clears numa_faults_locality after
numa_scan_period being doubled to fix this bug.

Signed-off-by: Tianchen Ding <tianchen.dingtianc@alibaba-inc.com>
Signed-off-by: Michael Wang <yun.wang@linux.alibaba.com>
---
 kernel/sched/fair.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 1a68a0536add..a61ee408202e 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2180,6 +2180,8 @@ static void update_task_scan_period(struct task_struct *p,
 		p->mm->numa_next_scan = jiffies +
 			msecs_to_jiffies(p->numa_scan_period);
 
+		memset(p->numa_faults_locality, 0,
+			sizeof(p->numa_faults_locality));
 		return;
 	}
 
-- 
2.25.1

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

* Re: [RFC PATCH] sched/numa: fix bug in update_task_scan_period
  2020-08-11  8:30 [RFC PATCH] sched/numa: fix bug in update_task_scan_period 丁天琛
@ 2020-08-11 11:01 ` Mel Gorman
  2020-08-12  3:51   ` 丁天琛
  0 siblings, 1 reply; 4+ messages in thread
From: Mel Gorman @ 2020-08-11 11:01 UTC (permalink / raw)
  To: ?????????
  Cc: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, linux-kernel,
	??????

On Tue, Aug 11, 2020 at 04:30:31PM +0800, ????????? wrote:
> When p->numa_faults_locality[2] > 0, numa_scan_period is doubled, but
> this array will never be cleared, which causes scanning period always
> reaching its max value. This patch clears numa_faults_locality after
> numa_scan_period being doubled to fix this bug.
> 

An out label at the end of the function to clears numa_faults_locality
would also work with a comment explaining why.  That aside, what is
the user-visible impact of the patch? If there are no useful faults or
migration failures, it makes sense that scanning is very slow until the
situation changes. The corner case is that a migration failure might keep
the scan rate slower than it should be but the flip side is that fixing
it might increase the scan rate and still incur migration failures which
introduces overhead with no gain.

-- 
Mel Gorman
SUSE Labs

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

* RE: [RFC PATCH] sched/numa: fix bug in update_task_scan_period
  2020-08-11 11:01 ` Mel Gorman
@ 2020-08-12  3:51   ` 丁天琛
  2020-08-14 13:15     ` Mel Gorman
  0 siblings, 1 reply; 4+ messages in thread
From: 丁天琛 @ 2020-08-12  3:51 UTC (permalink / raw)
  To: 'Mel Gorman'
  Cc: 'Ingo Molnar', 'Peter Zijlstra',
	'Juri Lelli', 'Vincent Guittot',
	'Dietmar Eggemann', 'Steven Rostedt',
	'Ben Segall', 'linux-kernel', '??????'

OK. Thanks for your advice and I'll use label instead.
In the case of migration failures, if there are still new failures after
clearing (meaning the node is still overloaded), the scanning period would
be doubled, just like not using this patch. However, if the failures do not
increase again, then the scanning period should be adjusted according to the
following rules (i.e., ps and lr ratio). I believe this is the original
design idea, right?

> -----Original Message-----
> From: Mel Gorman <mgorman@suse.de>
> Sent: Tuesday, August 11, 2020 7:02 PM
> To: Tianchen Ding <tianchen.dingtianc@alibaba-inc.com>
> Cc: Ingo Molnar <mingo@redhat.com>; Peter Zijlstra
> <peterz@infradead.org>; Juri Lelli <juri.lelli@redhat.com>; Vincent
Guittot
> <vincent.guittot@linaro.org>; Dietmar Eggemann
> <dietmar.eggemann@arm.com>; Steven Rostedt <rostedt@goodmis.org>;
> Ben Segall <bsegall@google.com>; linux-kernel <linux-
> kernel@vger.kernel.org>; ?????? <yun.wang@linux.alibaba.com>
> Subject: Re: [RFC PATCH] sched/numa: fix bug in update_task_scan_period
> 
> On Tue, Aug 11, 2020 at 04:30:31PM +0800, ????????? wrote:
> > When p->numa_faults_locality[2] > 0, numa_scan_period is doubled, but
> > this array will never be cleared, which causes scanning period always
> > reaching its max value. This patch clears numa_faults_locality after
> > numa_scan_period being doubled to fix this bug.
> >
> 
> An out label at the end of the function to clears numa_faults_locality
would
> also work with a comment explaining why.  That aside, what is the user-
> visible impact of the patch? If there are no useful faults or migration
failures,
> it makes sense that scanning is very slow until the situation changes. The
> corner case is that a migration failure might keep the scan rate slower
than it
> should be but the flip side is that fixing it might increase the scan rate
and still
> incur migration failures which introduces overhead with no gain.
> 
> --
> Mel Gorman
> SUSE Labs


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

* Re: [RFC PATCH] sched/numa: fix bug in update_task_scan_period
  2020-08-12  3:51   ` 丁天琛
@ 2020-08-14 13:15     ` Mel Gorman
  0 siblings, 0 replies; 4+ messages in thread
From: Mel Gorman @ 2020-08-14 13:15 UTC (permalink / raw)
  To: ?????????
  Cc: 'Ingo Molnar', 'Peter Zijlstra',
	'Juri Lelli', 'Vincent Guittot',
	'Dietmar Eggemann', 'Steven Rostedt',
	'Ben Segall', 'linux-kernel', '??????'

On Wed, Aug 12, 2020 at 11:51:54AM +0800, ????????? wrote:
> OK. Thanks for your advice and I'll use label instead.
> In the case of migration failures, if there are still new failures after
> clearing (meaning the node is still overloaded), the scanning period would
> be doubled, just like not using this patch. However, if the failures do not
> increase again, then the scanning period should be adjusted according to the
> following rules (i.e., ps and lr ratio). I believe this is the original
> design idea, right?
> 

The original idea was to simply throttle scanning if the faults were
useless. Your patch is probably correct but I would still like to see
some evidence of the user-visible impact. What tests have you conducted
to make sure it behaves better (or is at least neutral in most cases)?

-- 
Mel Gorman
SUSE Labs

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

end of thread, other threads:[~2020-08-14 13:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-11  8:30 [RFC PATCH] sched/numa: fix bug in update_task_scan_period 丁天琛
2020-08-11 11:01 ` Mel Gorman
2020-08-12  3:51   ` 丁天琛
2020-08-14 13:15     ` Mel Gorman

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