Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1680720 > unrolled thread
| Started by | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| First post | 2017-07-04 09:30 +0200 |
| Last post | 2017-07-04 13:10 +0200 |
| Articles | 7 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v2] sched/pelt: fix false running accounting Peter Zijlstra <peterz@infradead.org> - 2017-07-04 09:30 +0200
Re: [PATCH v2] sched/pelt: fix false running accounting Vincent Guittot <vincent.guittot@linaro.org> - 2017-07-04 09:40 +0200
Re: [PATCH v2] sched/pelt: fix false running accounting Peter Zijlstra <peterz@infradead.org> - 2017-07-04 10:40 +0200
Re: [PATCH v2] sched/pelt: fix false running accounting Vincent Guittot <vincent.guittot@linaro.org> - 2017-07-04 11:20 +0200
Re: [PATCH v2] sched/pelt: fix false running accounting Peter Zijlstra <peterz@infradead.org> - 2017-07-04 11:50 +0200
Re: [PATCH v2] sched/pelt: fix false running accounting Vincent Guittot <vincent.guittot@linaro.org> - 2017-07-04 12:00 +0200
Re: [PATCH v2] sched/pelt: fix false running accounting Peter Zijlstra <peterz@infradead.org> - 2017-07-04 13:10 +0200
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2017-07-04 09:30 +0200 |
| Subject | Re: [PATCH v2] sched/pelt: fix false running accounting |
| Message-ID | <tZqrw-5a4-31@gated-at.bofh.it> |
On Sat, Jul 01, 2017 at 07:06:13AM +0200, Vincent Guittot wrote: > The running state is a subset of runnable state which means that running > can't be set if runnable (weight) is cleared. There are corner cases > where the current sched_entity has been already dequeued but cfs_rq->curr > has not been updated yet and still points to the dequeued sched_entity. > If ___update_load_avg is called at that time, weight will be 0 and running > will be set which is not possible. > > This case happens during pick_next_task_fair() when a cfs_rq becomes idles. > The current sched_entity has been dequeued so se->on_rq is cleared and > cfs_rq->weight is null. But cfs_rq->curr still points to se (it will be > cleared when picking the idle thread). Because the cfs_rq becomes idle, > idle_balance() is called and ends up to call update_blocked_averages() > with these wrong running and runnable states. > > Add a test in ___update_load_avg to correct the running state in this case. Cute, however did you find that ?
[toc] | [next] | [standalone]
| From | Vincent Guittot <vincent.guittot@linaro.org> |
|---|---|
| Date | 2017-07-04 09:40 +0200 |
| Message-ID | <tZqBc-5fa-11@gated-at.bofh.it> |
| In reply to | #1680720 |
On 4 July 2017 at 09:27, Peter Zijlstra <peterz@infradead.org> wrote: > On Sat, Jul 01, 2017 at 07:06:13AM +0200, Vincent Guittot wrote: >> The running state is a subset of runnable state which means that running >> can't be set if runnable (weight) is cleared. There are corner cases >> where the current sched_entity has been already dequeued but cfs_rq->curr >> has not been updated yet and still points to the dequeued sched_entity. >> If ___update_load_avg is called at that time, weight will be 0 and running >> will be set which is not possible. >> >> This case happens during pick_next_task_fair() when a cfs_rq becomes idles. >> The current sched_entity has been dequeued so se->on_rq is cleared and >> cfs_rq->weight is null. But cfs_rq->curr still points to se (it will be >> cleared when picking the idle thread). Because the cfs_rq becomes idle, >> idle_balance() is called and ends up to call update_blocked_averages() >> with these wrong running and runnable states. >> >> Add a test in ___update_load_avg to correct the running state in this case. > > Cute, however did you find that ? In fact, while rebasing and running more tests on my patch "update scale invariance of PELT" that changes how to scale the load and utilization, I have seen that sometimes the utilization was increasing but not the load when CPU was going into idle state because the stolen_idle time was applied as idle time for load but running time for utilization. This patch has highlighted the problem.
[toc] | [prev] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2017-07-04 10:40 +0200 |
| Message-ID | <tZrxg-5SB-1@gated-at.bofh.it> |
| In reply to | #1680720 |
On Tue, Jul 04, 2017 at 09:27:07AM +0200, Peter Zijlstra wrote: > On Sat, Jul 01, 2017 at 07:06:13AM +0200, Vincent Guittot wrote: > > The running state is a subset of runnable state which means that running > > can't be set if runnable (weight) is cleared. There are corner cases > > where the current sched_entity has been already dequeued but cfs_rq->curr > > has not been updated yet and still points to the dequeued sched_entity. > > If ___update_load_avg is called at that time, weight will be 0 and running > > will be set which is not possible. > > > > This case happens during pick_next_task_fair() when a cfs_rq becomes idles. > > The current sched_entity has been dequeued so se->on_rq is cleared and > > cfs_rq->weight is null. But cfs_rq->curr still points to se (it will be > > cleared when picking the idle thread). Because the cfs_rq becomes idle, > > idle_balance() is called and ends up to call update_blocked_averages() > > with these wrong running and runnable states. > > > > Add a test in ___update_load_avg to correct the running state in this case. > > Cute, however did you find that ? Hmm,.. could you give a little more detail? Because if ->on_rq=0, we'll have done dequeue_task() which will have done update_curr() with ->on_rq, weight and ->running consistently. Then the above, inconsistent update should not happen, because delta=0.
[toc] | [prev] | [next] | [standalone]
| From | Vincent Guittot <vincent.guittot@linaro.org> |
|---|---|
| Date | 2017-07-04 11:20 +0200 |
| Message-ID | <tZs9X-6kT-1@gated-at.bofh.it> |
| In reply to | #1680760 |
On 4 July 2017 at 10:34, Peter Zijlstra <peterz@infradead.org> wrote: > On Tue, Jul 04, 2017 at 09:27:07AM +0200, Peter Zijlstra wrote: >> On Sat, Jul 01, 2017 at 07:06:13AM +0200, Vincent Guittot wrote: >> > The running state is a subset of runnable state which means that running >> > can't be set if runnable (weight) is cleared. There are corner cases >> > where the current sched_entity has been already dequeued but cfs_rq->curr >> > has not been updated yet and still points to the dequeued sched_entity. >> > If ___update_load_avg is called at that time, weight will be 0 and running >> > will be set which is not possible. >> > >> > This case happens during pick_next_task_fair() when a cfs_rq becomes idles. >> > The current sched_entity has been dequeued so se->on_rq is cleared and >> > cfs_rq->weight is null. But cfs_rq->curr still points to se (it will be >> > cleared when picking the idle thread). Because the cfs_rq becomes idle, >> > idle_balance() is called and ends up to call update_blocked_averages() >> > with these wrong running and runnable states. >> > >> > Add a test in ___update_load_avg to correct the running state in this case. >> >> Cute, however did you find that ? > > Hmm,.. could you give a little more detail? > > Because if ->on_rq=0, we'll have done dequeue_task() which will have > done update_curr() with ->on_rq, weight and ->running consistently. > > Then the above, inconsistent update should not happen, because delta=0. In fact, the delta between dequeue_entity_load_avg() and update_blocked_averages() is not 0 on my platform (hikey) but can be longer than 60us (at lowest frequency with only 1 task group level)
[toc] | [prev] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2017-07-04 11:50 +0200 |
| Message-ID | <tZsD0-6u0-15@gated-at.bofh.it> |
| In reply to | #1680790 |
On Tue, Jul 04, 2017 at 11:12:34AM +0200, Vincent Guittot wrote: > On 4 July 2017 at 10:34, Peter Zijlstra <peterz@infradead.org> wrote: > > On Tue, Jul 04, 2017 at 09:27:07AM +0200, Peter Zijlstra wrote: > >> On Sat, Jul 01, 2017 at 07:06:13AM +0200, Vincent Guittot wrote: > >> > The running state is a subset of runnable state which means that running > >> > can't be set if runnable (weight) is cleared. There are corner cases > >> > where the current sched_entity has been already dequeued but cfs_rq->curr > >> > has not been updated yet and still points to the dequeued sched_entity. > >> > If ___update_load_avg is called at that time, weight will be 0 and running > >> > will be set which is not possible. > >> > > >> > This case happens during pick_next_task_fair() when a cfs_rq becomes idles. > >> > The current sched_entity has been dequeued so se->on_rq is cleared and > >> > cfs_rq->weight is null. But cfs_rq->curr still points to se (it will be > >> > cleared when picking the idle thread). Because the cfs_rq becomes idle, > >> > idle_balance() is called and ends up to call update_blocked_averages() > >> > with these wrong running and runnable states. > >> > > >> > Add a test in ___update_load_avg to correct the running state in this case. > >> > >> Cute, however did you find that ? > > > > Hmm,.. could you give a little more detail? > > > > Because if ->on_rq=0, we'll have done dequeue_task() which will have > > done update_curr() with ->on_rq, weight and ->running consistently. > > > > Then the above, inconsistent update should not happen, because delta=0. > > In fact, the delta between dequeue_entity_load_avg() and > update_blocked_averages() is not 0 on my platform (hikey) but can be > longer than 60us (at lowest frequency with only 1 task group level) But but but, how can that happen? Should it not all be under the same rq->lock and thus have only a single update_rq_clock() and thus be at the same 'instant' ?
[toc] | [prev] | [next] | [standalone]
| From | Vincent Guittot <vincent.guittot@linaro.org> |
|---|---|
| Date | 2017-07-04 12:00 +0200 |
| Message-ID | <tZsMF-6xj-7@gated-at.bofh.it> |
| In reply to | #1680817 |
On 4 July 2017 at 11:44, Peter Zijlstra <peterz@infradead.org> wrote: > On Tue, Jul 04, 2017 at 11:12:34AM +0200, Vincent Guittot wrote: >> On 4 July 2017 at 10:34, Peter Zijlstra <peterz@infradead.org> wrote: >> > On Tue, Jul 04, 2017 at 09:27:07AM +0200, Peter Zijlstra wrote: >> >> On Sat, Jul 01, 2017 at 07:06:13AM +0200, Vincent Guittot wrote: >> >> > The running state is a subset of runnable state which means that running >> >> > can't be set if runnable (weight) is cleared. There are corner cases >> >> > where the current sched_entity has been already dequeued but cfs_rq->curr >> >> > has not been updated yet and still points to the dequeued sched_entity. >> >> > If ___update_load_avg is called at that time, weight will be 0 and running >> >> > will be set which is not possible. >> >> > >> >> > This case happens during pick_next_task_fair() when a cfs_rq becomes idles. >> >> > The current sched_entity has been dequeued so se->on_rq is cleared and >> >> > cfs_rq->weight is null. But cfs_rq->curr still points to se (it will be >> >> > cleared when picking the idle thread). Because the cfs_rq becomes idle, >> >> > idle_balance() is called and ends up to call update_blocked_averages() >> >> > with these wrong running and runnable states. >> >> > >> >> > Add a test in ___update_load_avg to correct the running state in this case. >> >> >> >> Cute, however did you find that ? >> > >> > Hmm,.. could you give a little more detail? >> > >> > Because if ->on_rq=0, we'll have done dequeue_task() which will have >> > done update_curr() with ->on_rq, weight and ->running consistently. >> > >> > Then the above, inconsistent update should not happen, because delta=0. >> >> In fact, the delta between dequeue_entity_load_avg() and >> update_blocked_averages() is not 0 on my platform (hikey) but can be >> longer than 60us (at lowest frequency with only 1 task group level) > > But but but, how can that happen? Should it not all be under the same > rq->lock and thus have only a single update_rq_clock() and thus be at > the same 'instant' ? idle_balance() unlock rq->lock before calling update_blocked_averages And update_blocked_averages() starts by calling update_rq_clock()
[toc] | [prev] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2017-07-04 13:10 +0200 |
| Message-ID | <tZtSp-7sm-5@gated-at.bofh.it> |
| In reply to | #1680822 |
On Tue, Jul 04, 2017 at 11:57:12AM +0200, Vincent Guittot wrote: > On 4 July 2017 at 11:44, Peter Zijlstra <peterz@infradead.org> wrote: > > But but but, how can that happen? Should it not all be under the same > > rq->lock and thus have only a single update_rq_clock() and thus be at > > the same 'instant' ? > > idle_balance() unlock rq->lock before calling update_blocked_averages > And update_blocked_averages() starts by calling update_rq_clock() Ah indeed. Might want to clarify that point.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web