Re: [PATCH v3] sched: sync with the prev cfs when changing cgroup within a cpu
From: Yuyang Du
Date: Wed Aug 12 2015 - 04:57:06 EST
On Wed, Aug 12, 2015 at 04:05:15PM +0900, byungchul.park@xxxxxxx wrote:
>
> current code seems to be wrong with cfs_rq's avg loads when changing
> a task's cgroup(=cfs_rq) to another. i tested with "echo pid > cgroup" and
> found that e.g. cfs_rq->avg.load_avg became larger and larger whenever i
> changed a cgroup to another again and again.
>
> we have to sync se's average load with both *prev* cfs_rq and next cfs_rq
> when changing its group.
>
I think you are right in general, it has nothing to do with
migrate_task_rq_fair() and the load should be carried to new cfs_rq.
But whether it is queued or not should be doing the same thing, so what about:
/* if queued, the previous dequeue_task() should have already done it */
if (!queued)
__upload_load_avg()
remove_from_old_cfs_rq();
/* virtually catch up because of the skew between cfs_rqs */
task's last_update_time = cfs_rq's last_update_time;
add_to_new_cfs_rq();
Thanks,
Yuyang
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/