Re: [RFC PATCH v2] sched/fair: search a task from the tail of the queue

From: Peter Zijlstra
Date: Wed Oct 04 2017 - 05:46:39 EST


On Wed, Sep 13, 2017 at 12:24:30PM +0200, Uladzislau Rezki (Sony) wrote:
> From: Uladzislau Rezki <urezki@xxxxxxxxx>
>
> As a first step this patch makes cfs_tasks list as MRU one.
> It means, that when a next task is picked to run on physical
> CPU it is moved to the front of the list.
>
> Therefore, the cfs_tasks list is more or less sorted (except
> woken tasks) starting from recently given CPU time tasks toward
> tasks with max wait time in a run-queue, i.e. MRU list.
>
> Second, as part of the load balance operation, this approach
> starts detach_tasks()/detach_one_task() from the tail of the
> queue instead of the head, giving some advantages:
>
> - tends to pick a task with highest wait time;
> - tasks located in the tail are less likely cache-hot,
> therefore the can_migrate_task() decision is higher.
>
> hackbench illustrates slightly better performance. For example
> doing 1000 samples and 40 groups on i5-3320M CPU, it shows below
> figures:
>
> default: 0.657 avg
> patched: 0.646 avg
>
> Signed-off-by: Uladzislau Rezki (Sony) <urezki@xxxxxxxxx>

Thanks!