9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] LOCK XADD for i386 incref/decref
       [not found] <r2zf75780241004281003ua9c23045xc4831f3735477989@mail.gmail.com>
@ 2010-04-28 19:16 ` Venkatesh Srinivas
  2010-04-29  2:39   ` Federico G. Benavento
  2010-09-07 19:48   ` erik quanstrom
  0 siblings, 2 replies; 4+ messages in thread
From: Venkatesh Srinivas @ 2010-04-28 19:16 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hi,

A few months ago, I added a patch to inferno-npe to use LOCK XADD
instead of the current lock/add/unlock sequence for incref and decref:
(http://code.google.com/p/inferno-npe/source/detail?r=b83540e1e77e62a19cbd21d2eb54d43d338716a5
and http://code.google.com/p/inferno-npe/source/detail?r=82f13e6755218ecb7dec0f1392b2eb8bfe0bb2c7).
On a 2.66 GHz Core 2 Duo, we noticed a full 14% reduction in runtime
(9.6s vs 11.2s) of the thread-ring test. Similar performance gains
were noticed on a Core i7 machine, but I no longer have the numbers
handy.

Perhaps this change is interesting for Plan 9...

-- vs



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] LOCK XADD for i386 incref/decref
  2010-04-28 19:16 ` [9fans] LOCK XADD for i386 incref/decref Venkatesh Srinivas
@ 2010-04-29  2:39   ` Federico G. Benavento
  2010-04-29  2:46     ` Federico G. Benavento
  2010-09-07 19:48   ` erik quanstrom
  1 sibling, 1 reply; 4+ messages in thread
From: Federico G. Benavento @ 2010-04-29  2:39 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

sorry, but why in the compiler and not as a library function like in libthread?

http://plan9.bell-labs.com/sources/plan9/sys/src/libthread/xinc386.s

On Wed, Apr 28, 2010 at 4:16 PM, Venkatesh Srinivas
<me@endeavour.zapto.org> wrote:
> Hi,
>
> A few months ago, I added a patch to inferno-npe to use LOCK XADD
> instead of the current lock/add/unlock sequence for incref and decref:
> (http://code.google.com/p/inferno-npe/source/detail?r=b83540e1e77e62a19cbd21d2eb54d43d338716a5
> and http://code.google.com/p/inferno-npe/source/detail?r=82f13e6755218ecb7dec0f1392b2eb8bfe0bb2c7).
> On a 2.66 GHz Core 2 Duo, we noticed a full 14% reduction in runtime
> (9.6s vs 11.2s) of the thread-ring test. Similar performance gains
> were noticed on a Core i7 machine, but I no longer have the numbers
> handy.
>
> Perhaps this change is interesting for Plan 9...
>
> -- vs
>
>



--
Federico G. Benavento



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] LOCK XADD for i386 incref/decref
  2010-04-29  2:39   ` Federico G. Benavento
@ 2010-04-29  2:46     ` Federico G. Benavento
  0 siblings, 0 replies; 4+ messages in thread
From: Federico G. Benavento @ 2010-04-29  2:46 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

sorry for the noise, I should rest a bit after this

On Wed, Apr 28, 2010 at 11:39 PM, Federico G. Benavento
<benavento@gmail.com> wrote:
> sorry, but why in the compiler and not as a library function like in libthread?
>
> http://plan9.bell-labs.com/sources/plan9/sys/src/libthread/xinc386.s
>
> On Wed, Apr 28, 2010 at 4:16 PM, Venkatesh Srinivas
> <me@endeavour.zapto.org> wrote:
>> Hi,
>>
>> A few months ago, I added a patch to inferno-npe to use LOCK XADD
>> instead of the current lock/add/unlock sequence for incref and decref:
>> (http://code.google.com/p/inferno-npe/source/detail?r=b83540e1e77e62a19cbd21d2eb54d43d338716a5
>> and http://code.google.com/p/inferno-npe/source/detail?r=82f13e6755218ecb7dec0f1392b2eb8bfe0bb2c7).
>> On a 2.66 GHz Core 2 Duo, we noticed a full 14% reduction in runtime
>> (9.6s vs 11.2s) of the thread-ring test. Similar performance gains
>> were noticed on a Core i7 machine, but I no longer have the numbers
>> handy.
>>
>> Perhaps this change is interesting for Plan 9...
>>
>> -- vs
>>
>>
>
>
>
> --
> Federico G. Benavento
>



--
Federico G. Benavento



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] LOCK XADD for i386 incref/decref
  2010-04-28 19:16 ` [9fans] LOCK XADD for i386 incref/decref Venkatesh Srinivas
  2010-04-29  2:39   ` Federico G. Benavento
@ 2010-09-07 19:48   ` erik quanstrom
  1 sibling, 0 replies; 4+ messages in thread
From: erik quanstrom @ 2010-09-07 19:48 UTC (permalink / raw)
  To: me, 9fans

On Wed Apr 28 15:18:01 EDT 2010, me@endeavour.zapto.org wrote:
> Hi,
>
> A few months ago, I added a patch to inferno-npe to use LOCK XADD
> instead of the current lock/add/unlock sequence for incref and decref:
> (http://code.google.com/p/inferno-npe/source/detail?r=b83540e1e77e62a19cbd21d2eb54d43d338716a5
> and http://code.google.com/p/inferno-npe/source/detail?r=82f13e6755218ecb7dec0f1392b2eb8bfe0bb2

sorry for the really long lag.  finally clearing out my
my inbox.

this patch is incorrect because incref() and decref()
assume that they are reusing the same lock that protects
the whole structure.  this incref is equivalent to
	lock(structure)
	structure->ref++;
	unlock(structure)
and not something like lock xadd.

- erik



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-09-07 19:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <r2zf75780241004281003ua9c23045xc4831f3735477989@mail.gmail.com>
2010-04-28 19:16 ` [9fans] LOCK XADD for i386 incref/decref Venkatesh Srinivas
2010-04-29  2:39   ` Federico G. Benavento
2010-04-29  2:46     ` Federico G. Benavento
2010-09-07 19:48   ` erik quanstrom

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).