Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1424878
| From | Yuyang Du <yuyang.du@intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v6 1/4] sched/fair: Fix attaching task sched avgs twice when switching to fair or changing task group |
| Date | 2016-06-17 12:10 +0200 |
| Message-ID | <rKYSS-5cu-35@gated-at.bofh.it> (permalink) |
| References | (4 earlier) <rKIuJ-2fo-15@gated-at.bofh.it> <rKKGd-3uC-1@gated-at.bofh.it> <rKKPT-3MT-1@gated-at.bofh.it> <rKLLX-4lm-7@gated-at.bofh.it> <rKN1p-53x-43@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, Jun 16, 2016 at 11:21:55PM +0200, Vincent Guittot wrote:
> On 16 June 2016 at 22:07, Peter Zijlstra <peterz@infradead.org> wrote:
> > On Thu, Jun 16, 2016 at 09:00:57PM +0200, Vincent Guittot wrote:
> >> On 16 June 2016 at 20:51, Peter Zijlstra <peterz@infradead.org> wrote:
> >> > On Thu, Jun 16, 2016 at 06:30:13PM +0200, Vincent Guittot wrote:
> >> >> With patch [1] for the init of cfs_rq side, all use cases will be
> >> >> covered regarding the issue linked to a last_update_time set to 0 at
> >> >> init
> >> >> [1] https://lkml.org/lkml/2016/5/30/508
> >> >
> >> > Aah, wait, now I get it :-)
> >> >
> >> > Still, we should put cfs_rq_clock_task(cfs_rq) in it, not 1. And since
> >> > we now acquire rq->lock on init this should well be possible. Lemme sort
> >> > that.
> >>
> >> yes with the rq->lock we can use cfs_rq_clock_task which is make more
> >> sense than 1.
> >> But the delta can be still significant between the creation of the
> >> task group and the 1st task that will be attach to the cfs_rq
> >
> > Ah, I think I've spotted more fail.
> >
> > And I think you're right, it doesn't matter, in fact, 0 should have been
> > fine too!
> >
> > enqueue_entity()
> > enqueue_entity_load_avg()
> > update_cfs_rq_load_avg()
> > now = clock()
> > __update_load_avg(&cfs_rq->avg)
> > cfs_rq->avg.last_load_update = now
> > // ages 0 load/util for: now - 0
> > if (migrated)
> > attach_entity_load_avg()
> > se->avg.last_load_update = cfs_rq->avg.last_load_update; // now != 0
> >
> > So I don't see how it can end up being attached again.
>
> In fact it has already been attached during the sched_move_task. The
> sequence for the 1st task that is attached to a cfs_rq is :
>
> sched_move_task()
> task_move_group_fair()
> detach_task_cfs_rq()
> set_task_rq()
> attach_task_cfs_rq()
> attach_entity_load_avg()
> se->avg.last_load_update = cfs_rq->avg.last_load_update == 0
>
Then again, does this fix it?
static void task_move_group_fair(struct task_struct *p)
{
detach_task_cfs_rq(p);
set_task_rq(p, task_cpu(p));
attach_task_cfs_rq(p);
/*
* If the cfs_rq's last_update_time is 0, attach the sched avgs
* won't be anything useful, as it will be decayed to 0 when any
* sched_entity is enqueued to that cfs_rq.
*
* On the other hand, if the cfs_rq's last_update_time is 0, we
* must reset the task's last_update_time to ensure we will attach
* the sched avgs when the task is enqueued.
*/
if (!cfs_rq_of(&p->se)->avg.last_update_time)
reset_task_last_update_time(p);
else
attach_entity_load_avg(cfs_rq_of(&p->se), &p->se);
}
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v6 0/4] sched/fair: Fix attach and detach sched avgs for task group change and sched class change Yuyang Du <yuyang.du@intel.com> - 2016-06-15 08:20 +0200
[PATCH v6 4/4] sched/fair: Add inline to detach_entity_load_evg() Yuyang Du <yuyang.du@intel.com> - 2016-06-15 08:20 +0200
[PATCH v6 2/4] sched/fair: Move load and util avgs from wake_up_new_task() to sched_fork() Yuyang Du <yuyang.du@intel.com> - 2016-06-15 08:20 +0200
[PATCH v6 1/4] sched/fair: Fix attaching task sched avgs twice when switching to fair or changing task group Yuyang Du <yuyang.du@intel.com> - 2016-06-15 08:20 +0200
Re: [PATCH v6 1/4] sched/fair: Fix attaching task sched avgs twice when switching to fair or changing task group Vincent Guittot <vincent.guittot@linaro.org> - 2016-06-15 09:50 +0200
Re: [PATCH v6 1/4] sched/fair: Fix attaching task sched avgs twice when switching to fair or changing task group Yuyang Du <yuyang.du@intel.com> - 2016-06-15 10:20 +0200
Re: [PATCH v6 1/4] sched/fair: Fix attaching task sched avgs twice when switching to fair or changing task group Vincent Guittot <vincent.guittot@linaro.org> - 2016-06-15 16:20 +0200
Re: [PATCH v6 1/4] sched/fair: Fix attaching task sched avgs twice when switching to fair or changing task group Peter Zijlstra <peterz@infradead.org> - 2016-06-15 17:30 +0200
Re: [PATCH v6 1/4] sched/fair: Fix attaching task sched avgs twice when switching to fair or changing task group Yuyang Du <yuyang.du@intel.com> - 2016-06-16 11:00 +0200
Re: [PATCH v6 1/4] sched/fair: Fix attaching task sched avgs twice when switching to fair or changing task group Vincent Guittot <vincent.guittot@linaro.org> - 2016-06-16 18:40 +0200
Re: [PATCH v6 1/4] sched/fair: Fix attaching task sched avgs twice when switching to fair or changing task group Peter Zijlstra <peterz@infradead.org> - 2016-06-16 19:20 +0200
Re: [PATCH v6 1/4] sched/fair: Fix attaching task sched avgs twice when switching to fair or changing task group Vincent Guittot <vincent.guittot@linaro.org> - 2016-06-16 21:00 +0200
Re: [PATCH v6 1/4] sched/fair: Fix attaching task sched avgs twice when switching to fair or changing task group Peter Zijlstra <peterz@infradead.org> - 2016-06-16 21:00 +0200
Re: [PATCH v6 1/4] sched/fair: Fix attaching task sched avgs twice when switching to fair or changing task group Vincent Guittot <vincent.guittot@linaro.org> - 2016-06-16 21:10 +0200
Re: [PATCH v6 1/4] sched/fair: Fix attaching task sched avgs twice when switching to fair or changing task group Peter Zijlstra <peterz@infradead.org> - 2016-06-16 22:10 +0200
Re: [PATCH v6 1/4] sched/fair: Fix attaching task sched avgs twice when switching to fair or changing task group Vincent Guittot <vincent.guittot@linaro.org> - 2016-06-16 23:30 +0200
Re: [PATCH v6 1/4] sched/fair: Fix attaching task sched avgs twice when switching to fair or changing task group Peter Zijlstra <peterz@infradead.org> - 2016-06-17 11:50 +0200
Re: [PATCH v6 1/4] sched/fair: Fix attaching task sched avgs twice when switching to fair or changing task group Yuyang Du <yuyang.du@intel.com> - 2016-06-17 12:10 +0200
Re: [PATCH v6 1/4] sched/fair: Fix attaching task sched avgs twice when switching to fair or changing task group Vincent Guittot <vincent.guittot@linaro.org> - 2016-06-17 14:10 +0200
Re: [PATCH v6 1/4] sched/fair: Fix attaching task sched avgs twice when switching to fair or changing task group Peter Zijlstra <peterz@infradead.org> - 2016-06-17 13:40 +0200
[PATCH v6 3/4] sched/fair: Skip detach sched avgs for new task when changing task groups Yuyang Du <yuyang.du@intel.com> - 2016-06-15 08:20 +0200
csiph-web