[ovs-dev] [PATCHv4 2/9] dpif-netdev: Group statistics updates in the slow path.

Ethan Jackson ethan at nicira.com
Mon Mar 30 20:22:21 UTC 2015


> Since statistics updates might require locking (in future commits)
> grouping them will reduce the locking overhead.

Do they actually require locking in future commits or is this speculative?

Adding locks for these stats seems like a pretty significant step
backwards, have you measured the overhead?

Ethan

>
> Signed-off-by: Daniele Di Proietto <diproiettod at vmware.com>
> ---
>  lib/dpif-netdev.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> index 6b61db4..2637e8d 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -2692,10 +2692,6 @@ dp_netdev_upcall(struct dp_netdev_pmd_thread *pmd, struct dp_packet *packet_,
>  {
>      struct dp_netdev *dp = pmd->dp;
>
> -    if (type == DPIF_UC_MISS) {
> -        dp_netdev_count_packet(pmd, DP_STAT_MISS, 1);
> -    }
> -
>      if (OVS_UNLIKELY(!dp->upcall_cb)) {
>          return ENODEV;
>      }
> @@ -2907,6 +2903,7 @@ fast_path_processing(struct dp_netdev_pmd_thread *pmd,
>      if (OVS_UNLIKELY(any_miss) && !fat_rwlock_tryrdlock(&dp->upcall_rwlock)) {
>          uint64_t actions_stub[512 / 8], slow_stub[512 / 8];
>          struct ofpbuf actions, put_actions;
> +        int miss_cnt = 0, lost_cnt = 0;
>          ovs_u128 ufid;
>
>          ofpbuf_use_stub(&actions, actions_stub, sizeof actions_stub);
> @@ -2931,6 +2928,8 @@ fast_path_processing(struct dp_netdev_pmd_thread *pmd,
>                  continue;
>              }
>
> +            miss_cnt++;
> +
>              miniflow_expand(&keys[i].mf, &match.flow);
>
>              ofpbuf_clear(&actions);
> @@ -2942,7 +2941,7 @@ fast_path_processing(struct dp_netdev_pmd_thread *pmd,
>                                       &put_actions);
>              if (OVS_UNLIKELY(error && error != ENOSPC)) {
>                  dp_packet_delete(packets[i]);
> -                dp_netdev_count_packet(pmd, DP_STAT_LOST, 1);
> +                lost_cnt++;
>                  continue;
>              }
>
> @@ -2976,6 +2975,8 @@ fast_path_processing(struct dp_netdev_pmd_thread *pmd,
>          ofpbuf_uninit(&actions);
>          ofpbuf_uninit(&put_actions);
>          fat_rwlock_unlock(&dp->upcall_rwlock);
> +        dp_netdev_count_packet(pmd, DP_STAT_MISS, miss_cnt);
> +        dp_netdev_count_packet(pmd, DP_STAT_LOST, lost_cnt);
>      } else if (OVS_UNLIKELY(any_miss)) {
>          int dropped_cnt = 0;
>
> --
> 2.1.4
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list