* Re: [PATCH 5/6 v2] IB: IP address based RDMA connection manager
[not found] <ORSMSX401FRaqbC8wSA0000000e@orsmsx401.amr.corp.intel.com>
@ 2006-03-13 15:43 ` Roland Dreier
2006-03-13 17:11 ` Sean Hefty
0 siblings, 1 reply; 3+ messages in thread
From: Roland Dreier @ 2006-03-13 15:43 UTC (permalink / raw)
To: Sean Hefty; +Cc: netdev, linux-kernel, openib-general
It seems that cma_detach_from_dev():
> +static void cma_detach_from_dev(struct rdma_id_private *id_priv)
> +{
> + list_del(&id_priv->list);
> + if (atomic_dec_and_test(&id_priv->cma_dev->refcount))
> + wake_up(&id_priv->cma_dev->wait);
> + id_priv->cma_dev = NULL;
> +}
doesn't need to do atomic_dec_and_test(), because it is never dropping
the last reference to id_priv (and in fact if it was, the last line
would be a use-after-free bug).
Does it make sense to replace it with:
static void cma_detach_from_dev(struct rdma_id_private *id_priv)
{
list_del(&id_priv->list);
/*
* cma_detach_from_dev() will never be dropping the last
* reference to id_priv, so no need to test here.
*/
atomic_dec(&id_priv->cma_dev->refcount);
id_priv->cma_dev = NULL;
}
on my x86_64 build that's worth
add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-40 (-40)
function old new delta
cma_detach_from_dev 106 66 -40
- R.
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH 5/6 v2] IB: IP address based RDMA connection manager
2006-03-13 15:43 ` [PATCH 5/6 v2] IB: IP address based RDMA connection manager Roland Dreier
@ 2006-03-13 17:11 ` Sean Hefty
0 siblings, 0 replies; 3+ messages in thread
From: Sean Hefty @ 2006-03-13 17:11 UTC (permalink / raw)
To: 'Roland Dreier'; +Cc: netdev, linux-kernel, openib-general
> > +static void cma_detach_from_dev(struct rdma_id_private *id_priv)
> > +{
> > + list_del(&id_priv->list);
> > + if (atomic_dec_and_test(&id_priv->cma_dev->refcount))
> > + wake_up(&id_priv->cma_dev->wait);
> > + id_priv->cma_dev = NULL;
> > +}
>
>doesn't need to do atomic_dec_and_test(), because it is never dropping
>the last reference to id_priv (and in fact if it was, the last line
>would be a use-after-free bug).
It's dropping the reference on cma_dev, as opposed to id_priv.
- Sean
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 5/6 v2] IB: IP address based RDMA connection manager
[not found] <ORSMSX401FRaqbC8wSA0000001e@orsmsx401.amr.corp.intel.com>
@ 2006-03-13 17:26 ` Roland Dreier
0 siblings, 0 replies; 3+ messages in thread
From: Roland Dreier @ 2006-03-13 17:26 UTC (permalink / raw)
To: Sean Hefty; +Cc: netdev, linux-kernel, openib-general
Sean> It's dropping the reference on cma_dev, as opposed to
Sean> id_priv.
Duh, sorry.
- R.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-03-13 17:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <ORSMSX401FRaqbC8wSA0000000e@orsmsx401.amr.corp.intel.com>
2006-03-13 15:43 ` [PATCH 5/6 v2] IB: IP address based RDMA connection manager Roland Dreier
2006-03-13 17:11 ` Sean Hefty
[not found] <ORSMSX401FRaqbC8wSA0000001e@orsmsx401.amr.corp.intel.com>
2006-03-13 17:26 ` Roland Dreier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).