event/sw: add unlikely branch predict
authorVipin Varghese <vipin.varghese@intel.com>
Tue, 27 Feb 2018 20:08:05 +0000 (01:38 +0530)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 16 Apr 2018 08:06:55 +0000 (10:06 +0200)
For most run cases 'sw->started' holds true. Adding a branch prediction
suggestion to compiler helps as this is first conditional check just
after entering the function.

Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
Acked-by: Kevin Laatz <kevin.laatz@intel.com>
drivers/event/sw/sw_evdev_scheduler.c

index 3106eb3..17bd4c0 100644 (file)
@@ -508,7 +508,7 @@ sw_event_schedule(struct rte_eventdev *dev)
        uint32_t i;
 
        sw->sched_called++;
-       if (!sw->started)
+       if (unlikely(!sw->started))
                return;
 
        do {