Commit d4f4ad90 authored by Soby Mathew's avatar Soby Mathew Committed by Dan Handley
Browse files

Remove the wfe() for bounded wait in bakery_lock

This patch is an optimization in the bakery_lock_get() function
which removes the wfe() when waiting for other contenders to choose
their ticket i.e when their `entering` flag is set. Since the time
taken to execute bakery_get_ticket() by other contenders is bounded,
this wait is a bounded time wait. Hence the removal of wfe() and the
corresponding sev() and dsb() in bakery_get_ticket() may result
in better time performance during lock acquisition.

Change-Id: I141bb21294226b54cb6e89e7cac0175c553afd8d
parent 1c73ffbd
...@@ -107,8 +107,6 @@ static unsigned int bakery_get_ticket(bakery_lock_t *bakery, unsigned int me) ...@@ -107,8 +107,6 @@ static unsigned int bakery_get_ticket(bakery_lock_t *bakery, unsigned int me)
++my_ticket; ++my_ticket;
bakery->number[me] = my_ticket; bakery->number[me] = my_ticket;
bakery->entering[me] = 0; bakery->entering[me] = 0;
dsb();
sev();
return my_ticket; return my_ticket;
} }
...@@ -151,7 +149,7 @@ void bakery_lock_get(bakery_lock_t *bakery) ...@@ -151,7 +149,7 @@ void bakery_lock_get(bakery_lock_t *bakery)
/* Wait for the contender to get their ticket */ /* Wait for the contender to get their ticket */
while (bakery->entering[they]) while (bakery->entering[they])
wfe(); ;
/* /*
* If the other party is a contender, they'll have non-zero * If the other party is a contender, they'll have non-zero
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment