sched/eevdf: O(1) fastpath for task selection
authorAbel Wu <wuyun.abel@bytedance.com>
Wed, 15 Nov 2023 03:36:46 +0000 (11:36 +0800)
committerPeter Zijlstra <peterz@infradead.org>
Wed, 15 Nov 2023 08:57:47 +0000 (09:57 +0100)
commitee4373dc902c0a403dd084b254ce70a78f95466f
tree75eb05528687edac88215593be6bb7ba6d29c69a
parent2227a957e1d5b1941be4e4207879ec74f4bb37f8
sched/eevdf: O(1) fastpath for task selection

Since the RB-tree is now sorted by deadline, let's first try the
leftmost entity which has the earliest virtual deadline. I've done
some benchmarks to see its effectiveness.

All the benchmarks are done inside a normal cpu cgroup in a clean
environment with cpu turbo disabled, on a dual-CPU Intel Xeon(R)
Platinum 8260 with 2 NUMA nodes each of which has 24C/48T.

  hackbench: process/thread + pipe/socket + 1/2/4/8 groups
  netperf:   TCP/UDP + STREAM/RR + 24/48/72/96/192 threads
  tbench:    loopback 24/48/72/96/192 threads
  schbench:  1/2/4/8 mthreads

  direct:    cfs_rq has only one entity
  parity:    RUN_TO_PARITY
  fast:      O(1) fastpath
  slow:      heap search

    (%) direct parity fast slow
  hackbench 92.95 2.02 4.91 0.12
  netperf 68.08 6.60 24.18 1.14
  tbench 67.55 11.22 20.61 0.62
  schbench 69.91 2.65 25.73 1.71

The above results indicate that this fastpath really makes task
selection more efficient.

Signed-off-by: Abel Wu <wuyun.abel@bytedance.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20231115033647.80785-4-wuyun.abel@bytedance.com
kernel/sched/fair.c