[v8,3/5] eal: use wait event scheme for mcslock
Checks
Commit Message
Instead of polling for mcslock to be updated, use wait event scheme
for this case.
Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
lib/eal/include/generic/rte_mcslock.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Comments
On Fri, Oct 29, 2021 at 1:50 PM Feifei Wang <feifei.wang2@arm.com> wrote:
>
> Instead of polling for mcslock to be updated, use wait event scheme
> for this case.
>
> Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
> ---
> lib/eal/include/generic/rte_mcslock.h | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/lib/eal/include/generic/rte_mcslock.h b/lib/eal/include/generic/rte_mcslock.h
> index 34f33c64a5..b4e07648ff 100644
> --- a/lib/eal/include/generic/rte_mcslock.h
> +++ b/lib/eal/include/generic/rte_mcslock.h
> @@ -116,8 +116,9 @@ rte_mcslock_unlock(rte_mcslock_t **msl, rte_mcslock_t *me)
> /* More nodes added to the queue by other CPUs.
> * Wait until the next pointer is set.
> */
> - while (__atomic_load_n(&me->next, __ATOMIC_RELAXED) == NULL)
> - rte_pause();
> + uintptr_t *next;
> + next = (uintptr_t *)&me->next;
> + rte_wait_event(next, UINTPTR_MAX, ==, 0, __ATOMIC_RELAXED);
> }
>
> /* Pass lock to next waiter. */
> --
> 2.25.1
>
On Fri, Oct 29, 2021 at 10:21 AM Feifei Wang <feifei.wang2@arm.com> wrote:
>
> Instead of polling for mcslock to be updated, use wait event scheme
> for this case.
Title prefix mcslock:
>
> Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
@@ -116,8 +116,9 @@ rte_mcslock_unlock(rte_mcslock_t **msl, rte_mcslock_t *me)
/* More nodes added to the queue by other CPUs.
* Wait until the next pointer is set.
*/
- while (__atomic_load_n(&me->next, __ATOMIC_RELAXED) == NULL)
- rte_pause();
+ uintptr_t *next;
+ next = (uintptr_t *)&me->next;
+ rte_wait_event(next, UINTPTR_MAX, ==, 0, __ATOMIC_RELAXED);
}
/* Pass lock to next waiter. */