Thanks for reply, Stephen.


I'm in x86-64, my cpu is `Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz`.



When allocation mbuf in program1, and transfer it to program2 for free
via ring, the program1 might meet assert in allocate mbuf sometimes.
(`RTE_ASSERT(rte_mbuf_refcnt_read(m) == 0);`)



but when I using gdb to check it, the refcnt field of mbuf is already
zero. so I believe the problem came from the cache line problem or
incorrect optimization.



When apply this patch, the problem seems solved. I'm submitting it for
your comments.


2016-09-03 0:12 GMT+08:00 Stephen Hemminger <stephen at networkplumber.org>:
> On Fri,  2 Sep 2016 13:25:06 +0800
> lilinzhe <slayercat.subscription at gmail.com> wrote:
>
>> From: ??? <lilinzhe at ijinshan.com>
>>
>> chagne atomic ref update to always call atomic_add
>>
>> when mbuf is allocated by cpu1 and freed by cpu2. cpu1 cache may not be 
>> updated by such a set operation.
>> causes refcnt reads incorrect values.
>
> What architecture are you dealing with? On X86 memory is cache coherent.
>
> Doing atomic operation all the time on each mbuf free would significantly
> slow down performance.
>

Reply via email to