[openib-general] [PATCH] Optimize cma_process_remove()
Sean Hefty
mshefty at ichips.intel.com
Tue Sep 12 08:34:22 PDT 2006
Krishna Kumar2 wrote:
> mutex_lock(&lock);
> while (!list_empty(&cma_dev->id_list)) {
> id_priv = list_entry(cma_dev->id_list.next,
> struct rdma_id_private, list);
>
> if (cma_internal_listen(id_priv)) {
> cma_destroy_listen(id_priv);
> } else {
> atomic_inc(&id_priv->refcount);
> list_del(&id_priv->list);
> list_add_tail(&id_priv->list, &remove_list);
> }
> }
> mutex_unlock(&lock);
>
> list_for_each_entry_safe(id_priv, tmp, &remove_list, list) {
> ret = cma_remove_id_dev(id_priv);
> cma_deref_id(id_priv);
> if (ret)
> rdma_destroy_id(&id_priv->id);
> }
I believe that this has the same issue. If a user tries to destroy an
rdma_cm_id, it will remove itself from the "device list". (This is why the ID's
are moved to a new list, so that the removal still works.) In the code above,
destroy thread(s) will remove ID(s) from the remove_list while we're trying to
walk it.
- Sean
More information about the general
mailing list