Re: Problem with uipc_mbuf.c

2006-09-20 Thread Randall Stewart
Andre Oppermann wrote: Maxim Konovalov wrote: On Tue, 29 Aug 2006, 17:15+0200, Andre Oppermann wrote: John-Mark Gurney wrote: Randall Stewart wrote this message on Mon, Aug 28, 2006 at 17:04 -0400: atomic_fetchadd_int(m->m_ext.ref_cnt, -1) == 0) { ^ This should be 1 not 0.

Re: Problem with uipc_mbuf.c

2006-09-07 Thread Randall Stewart
Andre: Without the "fix" SCTP leaks mbufs when running netpipe.. for some reason my other tests (utilites) do not do so.. but I think it has to do with the back-and-forth nature of netpipe.. it sends and then receives constantly while most of the other things I play with have a source and a sink.

Re: Problem with uipc_mbuf.c

2006-09-02 Thread Andre Oppermann
Maxim Konovalov wrote: On Tue, 29 Aug 2006, 17:15+0200, Andre Oppermann wrote: John-Mark Gurney wrote: Randall Stewart wrote this message on Mon, Aug 28, 2006 at 17:04 -0400: atomic_fetchadd_int(m->m_ext.ref_cnt, -1) == 0) { ^ This should be 1 not 0.. as apparently fetchadd_int

Re: Problem with uipc_mbuf.c

2006-09-01 Thread Maxim Konovalov
On Tue, 29 Aug 2006, 17:15+0200, Andre Oppermann wrote: > John-Mark Gurney wrote: > > Randall Stewart wrote this message on Mon, Aug 28, 2006 at 17:04 -0400: > > > atomic_fetchadd_int(m->m_ext.ref_cnt, -1) == 0) { > > ^ > > > > This should be 1 not 0.. as apparently fetchadd_int return

Re: Problem with uipc_mbuf.c

2006-08-29 Thread John-Mark Gurney
Randall Stewart wrote this message on Tue, Aug 29, 2006 at 10:18 -0400: > Ok, I confirmed it... > > Changing it to be > > atomic_fetchadd_int(m->m_ext.ref_cnt, -1) == 1) > > Fixes the problem.. no more leaks :-D And if you are curious XADD is: The XADD (exchange and add) instruction swaps two o

Re: Problem with uipc_mbuf.c

2006-08-29 Thread Andre Oppermann
John-Mark Gurney wrote: Randall Stewart wrote this message on Mon, Aug 28, 2006 at 17:04 -0400: atomic_fetchadd_int(m->m_ext.ref_cnt, -1) == 0) { ^ This should be 1 not 0.. as apparently fetchadd_int returns the old value (at

Re: Problem with uipc_mbuf.c

2006-08-29 Thread Randall Stewart
John-Mark: Ok, I confirmed it... Changing it to be atomic_fetchadd_int(m->m_ext.ref_cnt, -1) == 1) Fixes the problem.. no more leaks :-D R John-Mark Gurney wrote: Randall Stewart wrote this message on Mon, Aug 28, 2006 at 17:04 -0400: atomic_fetchadd_int(m->m_ext.ref_cnt, -1)

Re: Problem with uipc_mbuf.c

2006-08-29 Thread Randall Stewart
John-Mark: I had read that in the atomic_fetchadd_int() comments.. and was wondering if that was the case.. I don't have an X86 assembler reference.. so I did not bother to see if the asm and comments were in sync... you are right if this is true.. and I can surely make SCTP have this occur.. not

Re: Problem with uipc_mbuf.c

2006-08-28 Thread John-Mark Gurney
Randall Stewart wrote this message on Mon, Aug 28, 2006 at 17:04 -0400: > atomic_fetchadd_int(m->m_ext.ref_cnt, -1) == 0) { ^ This should be 1 not 0.. as apparently fetchadd_int returns the old value (at least that's what atomic(9)

Problem with uipc_mbuf.c

2006-08-28 Thread Randall Stewart
Hi all: In 6.1 the function mb_free_ext(struct mbuf *m) looked like this: ... void mb_free_ext(struct mbuf *m) { u_int cnt; int dofree; /* Account for lazy ref count assign. */ if (m->m_ext.ref_cnt == NULL)