Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1719620

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

From Uladzislau Rezki <urezki@gmail.com>
Newsgroups linux.kernel
Subject Re: [RFC][PATCH]: sched/fair: search a task from the tail of the queue
Date 2017-08-25 00:30 +0200
Message-ID <ui8Nr-49D-1@gated-at.bofh.it> (permalink)
References <uhXS2-5i7-9@gated-at.bofh.it> <uhXS2-5i7-15@gated-at.bofh.it> <ui4qu-1bx-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[RFC][PATCH]: sched/fair: search a task from the tail of the queue "Uladzislau Rezki (Sony)" <urezki@gmail.com> - 2017-08-24 12:50 +0200
  [RFC][PATCH]: sched/fair: search a task from the tail of the queue "Uladzislau Rezki (Sony)" <urezki@gmail.com> - 2017-08-24 12:50 +0200
    Re: [RFC][PATCH]: sched/fair: search a task from the tail of the  queue Peter Zijlstra <peterz@infradead.org> - 2017-08-24 19:50 +0200
      Re: [RFC][PATCH]: sched/fair: search a task from the tail of the queue Uladzislau Rezki <urezki@gmail.com> - 2017-08-25 00:30 +0200

csiph-web