From: Charles Wang <muming.wq@gmail.com>
To: Doug Smythies <dsmythies@telus.net>
Cc: "'Peter Zijlstra'" <peterz@infradead.org>,
linux-kernel@vger.kernel.org, "'Ingo Molnar'" <mingo@redhat.com>,
"'Tao Ma'" <tm@tao.ma>, '含黛' <handai.szj@taobao.com>
Subject: Re: [PATCH] sched: Folding nohz load accounting more accurate
Date: Mon, 18 Jun 2012 22:41:52 +0800 [thread overview]
Message-ID: <4FDF3E30.2090307@gmail.com> (raw)
In-Reply-To: <001401cd4d1d$79f370c0$6dda5240$@net>
Peter's patch works the well. Now I ported the second patch
to fix high load problem based on Peter's. It works fine on my testing
environment. Doug, please try this. Thanks.
In our mind per-cpu sampling for cpu idle and non-idle is equal. But
actually may not. For non-idle cpu sampling, it's right the load when
sampling. But for idle, cause of nohz, the sampling will be delayed to
nohz exit(less than 1 tick after nohz exit). Nohz exit is always caused
by processes woken up--non-idle model. It's not fair here. Idle
sampling will be turned to non-idle sampling. And cause loadavg being
higher than normal.
time-expected-sampling
| time-do-sampling
| |
V V
-|-------------------------|--
start_nohz stop_nohz
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 4101a0e..180e612 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2228,6 +2228,7 @@ void calc_load_account_idle(struct rq *this_rq)
int idx;
delta = calc_load_fold_active(this_rq);
+ this_rq->last_idle_enter = jiffies;
if (delta) {
idx = calc_load_write_idx();
atomic_long_add(delta, &calc_load_idle[idx]);
@@ -2431,15 +2432,27 @@ void calc_global_load(void)
static void calc_load_account_active(struct rq *this_rq)
{
long delta;
+ unsigned long delta_time;
+ long last_idle_time_elapse;
if (time_before(jiffies, this_rq->calc_load_update))
return;
+ last_idle_time_elapse = this_rq->last_idle_enter - calc_load_update;
+ delta_time = jiffies - this_rq->calc_load_update;
+
+ if (last_idle_time_elapse > 0)
+ goto out;
+
+ if ((last_idle_time_elapse > -1) && (delta_time >= 1))
+ goto out;
+
delta = calc_load_fold_active(this_rq);
delta += calc_load_fold_idle();
if (delta)
atomic_long_add(delta, &calc_load_tasks);
+out:
this_rq->calc_load_update += LOAD_FREQ;
}
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 4134d37..a356588 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -438,6 +438,7 @@ struct rq {
/* calc_load related fields */
unsigned long calc_load_update;
+ unsigned long last_idle_enter;
long calc_load_active;
#ifdef CONFIG_SCHED_HRTICK
--
1.7.9.5
next prev parent reply other threads:[~2012-06-18 14:41 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-09 10:54 [PATCH] sched: Folding nohz load accounting more accurate Charles Wang
2012-06-11 15:42 ` Peter Zijlstra
[not found] ` <4FD6BFC4.1060302@gmail.com>
2012-06-12 8:54 ` Peter Zijlstra
2012-06-12 9:34 ` Charles Wang
2012-06-12 9:56 ` Peter Zijlstra
2012-06-13 5:55 ` Doug Smythies
2012-06-13 7:56 ` Charles Wang
2012-06-14 4:41 ` Doug Smythies
2012-06-14 15:42 ` Charles Wang
2012-06-16 6:42 ` Doug Smythies
2012-06-13 8:16 ` Peter Zijlstra
2012-06-13 15:33 ` Doug Smythies
2012-06-13 21:57 ` Peter Zijlstra
2012-06-14 3:13 ` Doug Smythies
2012-06-18 10:13 ` Peter Zijlstra
2012-07-20 19:24 ` sched: care and feeding of load-avg code (Re: [PATCH] sched: Folding nohz load accounting more accurate) Jonathan Nieder
2012-06-15 14:27 ` [PATCH] sched: Folding nohz load accounting more accurate Charles Wang
2012-06-15 17:39 ` Peter Zijlstra
2012-06-16 14:53 ` Doug Smythies
2012-06-18 6:41 ` Doug Smythies
2012-06-18 14:41 ` Charles Wang [this message]
2012-06-18 10:06 ` Charles Wang
2012-06-18 16:03 ` Peter Zijlstra
2012-06-19 6:08 ` Yong Zhang
2012-06-19 9:18 ` Peter Zijlstra
2012-06-19 15:50 ` Doug Smythies
2012-06-20 9:45 ` Peter Zijlstra
2012-06-21 4:12 ` Doug Smythies
2012-06-21 6:35 ` Charles Wang
2012-06-21 8:48 ` Peter Zijlstra
2012-06-22 14:03 ` Peter Zijlstra
2012-06-24 21:45 ` Doug Smythies
2012-07-03 16:01 ` Doug Smythies
2012-06-25 2:15 ` Charles Wang
2012-07-06 6:19 ` [tip:sched/core] sched/nohz: Rewrite and fix load-avg computation -- again tip-bot for Peter Zijlstra
2012-06-19 6:19 ` [PATCH] sched: Folding nohz load accounting more accurate Doug Smythies
2012-06-19 6:24 ` Charles Wang
2012-06-19 9:57 ` Peter Zijlstra
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=4FDF3E30.2090307@gmail.com \
--to=muming.wq@gmail.com \
--cc=dsmythies@telus.net \
--cc=handai.szj@taobao.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tm@tao.ma \
/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.