• Chris Wilson's avatar
    drm/i915/breadcrumbs: Reduce signaler rbtree to a sorted list · cd46c545
    Chris Wilson authored
    The goal here is to try and reduce the latency of signaling additional
    requests following the wakeup from interrupt by reducing the list of
    to-be-signaled requests from an rbtree to a sorted linked list. The
    original choice of using an rbtree was to facilitate random insertions
    of request into the signaler while maintaining a sorted list. However,
    if we assume that most new requests are added when they are submitted,
    we see those new requests in execution order making a insertion sort
    fast, and the reduction in overhead of each signaler iteration
    significant.
    
    Since commit 56299fb7 ("drm/i915: Signal first fence from irq handler
    if complete"), we signal most fences directly from notify_ring() in the
    interrupt handler greatly reducing the amount of work that actually
    needs to be done by the signaler kthread. All the thread is then
    required to do is operate as the bottom-half, cleaning up after the
    interrupt handler and preparing the next waiter. This includes signaling
    all later completed fences in a saturated system, but on a mostly idle
    system we only have to rebuild the wait rbtree in time for the next
    interrupt. With this de-emphasis of the signaler's role, we want to
    rejig it's datastructures to reduce the amount of work we require to
    both setup the signal tree and maintain it on every interrupt.
    
    References: 56299fb7 ("drm/i915: Signal first fence from irq handler if complete")
    Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
    Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
    Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
    Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
    Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20180222092545.17216-1-chris@chris-wilson.co.uk
    cd46c545
intel_ringbuffer.h 33.7 KB