Felix Huettner <[email protected]> writes:

> We replace the existing rculists used for conntrack sweeping with just
> iterating over all known connections. This allows us to get rid of the
> exp_lists in struct conntrack and thereby also of the usage of ct_lock
> in the connection insert and deletion path.
> 
> This means after this commit connection insertion and deletion across
> different zones has no longer any shared lock. Within the same zone
> there is still a single lock.
> 
> The exp_lists where not ordered in any way, the only difference compared
> to iterating over all connections was that they only contained
> connections in the forward direction.
> This means that this patch will trade away some cleaning performance in
> order to gain connection insertion and deletion speeds. We will improve
> the ct cleaning in the following commits.
> 
> Signed-off-by: Felix Huettner <[email protected]>
> ---
> 
> Notes:
>     v3->v4: split to 4 patches, this is 4/4 of the previous patch 5
> 
>  lib/conntrack-private.h | 11 +-----
>  lib/conntrack.c         | 84 ++++++++++++++++-------------------------
>  2 files changed, 33 insertions(+), 62 deletions(-)

[...]

> @@ -1513,29 +1492,35 @@ conntrack_get_sweep_interval(struct conntrack *ct)
>  }
>  
>  static size_t
> -ct_sweep(struct conntrack *ct, struct rculist *list, long long now,
> -         size_t *cleaned_count)
> +ct_sweep_zone(struct conntrack *ct, uint16_t zone, long long now,
> +              size_t *cleaned_count)
>      OVS_NO_THREAD_SAFETY_ANALYSIS
>  {
> +    struct conn_key_node *keyn;
> +    struct conntrack_zone *cz;
> +    unsigned int conn_count = 0;
> +    unsigned int cleaned = 0;
>      struct conn *conn;
> -    size_t cleaned = 0;
> -    size_t count = 0;
> +    long long expiration;
>  
> -    RCULIST_FOR_EACH (conn, node, list) {
> -        if (conn_expired(conn, now)) {
> +    cz = zone_lookup(ct, zone);
> +    CMAP_FOR_EACH (keyn, cm_node, &cz->conns) {
> +        if (keyn->dir != CT_DIR_FWD) {
> +            continue;
> +        }
> +
> +        conn = CONTAINER_OF(keyn, struct conn, key_node[keyn->dir]);
> +        expiration = conn_expiration(conn);
> +        if (now >= expiration) {
>              conn_clean(ct, conn);
>              cleaned++;
>          }
>  
> -        count++;
> +        conn_count++;
>      }
> -
> -    if (cleaned_count) {
> -        *cleaned_count = cleaned;
> -    }
> -
> -    return count;
> -}
> +    *cleaned_count = cleaned;
> +    return conn_count;
> + }

  ^  Spacing here.

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to