From: Petri Savolainen <petri.savolai...@linaro.org>

Save ring pointer into stash to avoid table lookups
when releasing the atomic context.

Signed-off-by: Petri Savolainen <petri.savolai...@linaro.org>
---
/** Email created from pull request 699 (psavol:master-sched-optim-clean-ups)
 ** https://github.com/Linaro/odp/pull/699
 ** Patch: https://github.com/Linaro/odp/pull/699.patch
 ** Base sha: 33fbc04b6373960ec3f84de4e7e7b34c49d71508
 ** Merge commit sha: 32d7a11f22e6f2e1e378b653993c5377d4116d8f
 **/
 platform/linux-generic/odp_schedule_basic.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/platform/linux-generic/odp_schedule_basic.c 
b/platform/linux-generic/odp_schedule_basic.c
index 6ed1f8b49..77fee74dd 100644
--- a/platform/linux-generic/odp_schedule_basic.c
+++ b/platform/linux-generic/odp_schedule_basic.c
@@ -137,6 +137,7 @@ typedef struct ODP_ALIGNED_CACHE {
                uint16_t    ev_index;
                uint32_t    qi;
                odp_queue_t queue;
+               ring_t      *ring;
                odp_event_t ev[BURST_SIZE_MAX];
        } stash;
 
@@ -604,10 +605,7 @@ static void schedule_pktio_start(int pktio_index, int 
num_pktin,
 static inline void release_atomic(void)
 {
        uint32_t qi  = sched_local.stash.qi;
-       int grp      = sched->queue[qi].grp;
-       int prio     = sched->queue[qi].prio;
-       int spread   = sched->queue[qi].spread;
-       ring_t *ring = &sched->prio_q[grp][prio][spread].ring;
+       ring_t *ring = sched_local.stash.ring;
 
        /* Release current atomic queue */
        ring_enq(ring, sched->ring_mask, qi);
@@ -990,8 +988,9 @@ static inline int do_schedule_grp(odp_queue_t *out_queue, 
odp_event_t out_ev[],
 
                        } else if (sync_ctx == ODP_SCHED_SYNC_ATOMIC) {
                                /* Hold queue during atomic access */
-                               sched_local.stash.qi = qi;
-                               sched_local.sync_ctx = sync_ctx;
+                               sched_local.stash.qi   = qi;
+                               sched_local.stash.ring = ring;
+                               sched_local.sync_ctx   = sync_ctx;
                        } else {
                                /* Continue scheduling the queue */
                                ring_enq(ring, ring_mask, qi);

Reply via email to