On Thu, Jan 12, 2017 at 6:27 AM, Savolainen, Petri (Nokia - FI/Espoo)
<petri.savolai...@nokia-bell-labs.com> wrote:
>
>
>> -----Original Message-----
>> From: Bill Fischofer [mailto:bill.fischo...@linaro.org]
>> Sent: Thursday, January 12, 2017 2:22 PM
>> To: Savolainen, Petri (Nokia - FI/Espoo) <petri.savolainen@nokia-bell-
>> labs.com>
>> Cc: lng-odp@lists.linaro.org
>> Subject: Re: [lng-odp] [API-NEXT PATCHv6 2/5] linux-generic: packet:
>> implement reference apis
>>
>> On Thu, Jan 12, 2017 at 6:12 AM, Savolainen, Petri (Nokia - FI/Espoo)
>> <petri.savolai...@nokia-bell-labs.com> wrote:
>> > This patch is now merged, although I had some doubts that it has bad
>> impact on performance. Here are some performance results for couple of
>> simple, single thread packet alloc/free test cases. No references
>> involved, just plain packets as before.
>> >
>> > Test results before and after "linux-generic: packet: implement
>> reference apis":
>> >
>> >                         CPU cycles per operation
>> >                                 before  after
>> > packet_alloc            127.8           250.9           +96 %
>> > packet_alloc_multi      873.7           1538.8  +76 %
>> > packet_free                     31              116.8           +277 %
>> > packet_free_multi               214.5           1369.2  +538 %
>> > packet_alloc_free               73.4            193.7           +164 %
>> > packet_alloc_free_multi 286.1           1228.8  +330 %
>> >
>> >
>> > Huge performance degradation. Numbers are now many times worse than
>> before or after my optimizations. To me this shows that almost a complete
>> rewrite (or revert) is needed.
>>
>> My guess is this is due to the atomics needed for reference counting
>> not being properly inlined internally. I know you did similar
>> optimizations for ticketlocks. Let me look into this and post a patch
>> that does the same for the atomics.
>
> Atomics are inlined already. Also atomic operations should not be required if 
> there's a single refence.

The ref_count still needs to be initialized on alloc and decremented
on free to see if the packet should really be freed. The only way to
know whether you're dealing with a single reference or not is to
check. Do you have a breakdown of where the hotspots are? These
numbers do seem high.

>
> -Petri
>
>

Reply via email to