lkml.org 
[lkml]   [2017]   [Aug]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [RFC][PATCH]: sched/fair: search a task from the tail of the queue
On Thu, Aug 24, 2017 at 7:46 PM, Peter Zijlstra <peterz@infradead.org> wrote:
>
> On Thu, Aug 24, 2017 at 12:44:45PM +0200, Uladzislau Rezki (Sony) wrote:
> > From: Uladzislau Rezki <urezki@gmail.com>
> >
> > When a task is enqueued back from a physical CPU to the running
> > list it is placed in the beginning of the queue. Thus, 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.
>
> Hurm... that is only true for short running tasks, the moment you get
> things like involuntary preemption that's completely off.
>
> Imagine starting 3 busy-spinning tasks, lets call then A, B and C.
>
> So our cfs_tasks list is ordered: C B A, since C is the last task we
> started.
>
> At this point, C might also be the leftmost task, since it has ran
> least. But the moment we let A run its full quantum it will become the
> rightmost and we'll pick C. Let C run its full quantum and that becomes
> the rightmost.
>
> So now we have, in our tree: B A C, while our list is still C B A. No
> relation left what so ever.
>
I totally agree with your point and explanation.

> How, hackbench will be very short running tasks, so the list tends to be
> better ordered vs the tree.
>
> That said, functionally it really doesn't matter what way around the
> list we iterate for migration, so if this is a win for some, that's
> nice. But it would be nice to get more benchmarks ran to see if there is
> cases where it hurts.

>
> Another thing you could play with is making pick_next_task_fair() move
> the selected task to the front of the list. That way the list becomes a
> MRU and picking from the tail always makes sense.
>
Apparently, briefly looking at account_entity_enqueue function and not paying
much attention, i thought that the list is updated each time when a
task is moved
from/to rb tree, but that is not true. Thank you for your point!

I have uploaded a new patch set here: https://lkml.org/lkml/2017/8/24/860

--
Vlad Rezki

\
 
 \ /
  Last update: 2017-08-25 00:20    [W:0.140 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site