[jira] [Commented] (TS-1742) Freelists to use 64bit version w/ Double Word Compare and Swap

2013-03-26 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-1742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13614398#comment-13614398
 ] 

ASF subversion and git services commented on TS-1742:
-

Commit ca7a84eebd0711c254959fc723d9de73f10aef68 in branch refs/heads/master 
from Brian Geffon bgef...@bgeffon-mn1.linkedin.biz
[ https://git-wip-us.apache.org/repos/asf?p=trafficserver.git;h=ca7a84e ]

TS-1742: correct 32bit freelist case


 Freelists to use 64bit version w/ Double Word Compare and Swap
 --

 Key: TS-1742
 URL: https://issues.apache.org/jira/browse/TS-1742
 Project: Traffic Server
  Issue Type: Improvement
Reporter: Brian Geffon
Assignee: Brian Geffon
 Fix For: 3.3.2

 Attachments: 128bit_cas.patch, 128bit_cas.patch.2


 So to those of you familiar with the freelists you know that it works this 
 way the head pointer uses the upper 16 bits for a version to prevent the ABA 
 problem. The big drawback to this is that it requires the following macros to 
 get at the pointer or the version:
 {code}
 #define FREELIST_POINTER(_x) ((void*)(intptr_t)(_x).data)16)16) | \
  (((~intptr_t)(_x).data)1663)-1))48)48)))  // sign extend
 #define FREELIST_VERSION(_x) (((intptr_t)(_x).data)48)
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
   (_x).data = intptr_t)(_p))0xULL) | (((_v)0xULL) 
  48))
 {code}
 Additionally, since this only leaves 16 bits it limits the number of versions 
 you can have, well more and more x86_64 processors support DCAS (double word 
 compare and swap / 128bit CAS). This means that we can use 64bits for a 
 version which basically makes the versions unlimited but more importantly it 
 takes those macros above and simplifies them to:
 {code}
 #define FREELIST_POINTER(_x) (_x).s.pointer
 #define FREELIST_VERSION(_x) (_x).s.version
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
 (_x).s.pointer = _p; (_x).s.version = _v
 {code}
 As you can imagine this will have a performance improvement, in my simple 
 tests I measured a performance improvement of around 6%. Unfortunately, I'm 
 not an expert with this stuff and I would really appreciate more community 
 feedback before I commit this patch.
 Note: this only applies if you're not using a reclaimable freelist.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (TS-1742) Freelists to use 64bit version w/ Double Word Compare and Swap

2013-03-25 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-1742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13613017#comment-13613017
 ] 

ASF subversion and git services commented on TS-1742:
-

Commit 18aadb0c7b1a7f74935107764696bba702608635 in branch refs/heads/master 
from James Peach jpe...@apache.org
[ https://git-wip-us.apache.org/repos/asf?p=trafficserver.git;h=18aadb0 ]

TS-1742: use __sync_val_compare_and_swap for atomic 16 byte reads

clang correctly emits cmpxchg16b for __sync_val_compare_and_swap(),
so let's use that instead of __sync_fetch_and_add().


 Freelists to use 64bit version w/ Double Word Compare and Swap
 --

 Key: TS-1742
 URL: https://issues.apache.org/jira/browse/TS-1742
 Project: Traffic Server
  Issue Type: Improvement
Reporter: Brian Geffon
Assignee: Brian Geffon
 Fix For: 3.3.2

 Attachments: 128bit_cas.patch, 128bit_cas.patch.2


 So to those of you familiar with the freelists you know that it works this 
 way the head pointer uses the upper 16 bits for a version to prevent the ABA 
 problem. The big drawback to this is that it requires the following macros to 
 get at the pointer or the version:
 {code}
 #define FREELIST_POINTER(_x) ((void*)(intptr_t)(_x).data)16)16) | \
  (((~intptr_t)(_x).data)1663)-1))48)48)))  // sign extend
 #define FREELIST_VERSION(_x) (((intptr_t)(_x).data)48)
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
   (_x).data = intptr_t)(_p))0xULL) | (((_v)0xULL) 
  48))
 {code}
 Additionally, since this only leaves 16 bits it limits the number of versions 
 you can have, well more and more x86_64 processors support DCAS (double word 
 compare and swap / 128bit CAS). This means that we can use 64bits for a 
 version which basically makes the versions unlimited but more importantly it 
 takes those macros above and simplifies them to:
 {code}
 #define FREELIST_POINTER(_x) (_x).s.pointer
 #define FREELIST_VERSION(_x) (_x).s.version
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
 (_x).s.pointer = _p; (_x).s.version = _v
 {code}
 As you can imagine this will have a performance improvement, in my simple 
 tests I measured a performance improvement of around 6%. Unfortunately, I'm 
 not an expert with this stuff and I would really appreciate more community 
 feedback before I commit this patch.
 Note: this only applies if you're not using a reclaimable freelist.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (TS-1742) Freelists to use 64bit version w/ Double Word Compare and Swap

2013-03-25 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-1742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13613016#comment-13613016
 ] 

ASF subversion and git services commented on TS-1742:
-

Commit 70e10888506cdd41fa8eae86a2878cfb8a71f0fa in branch refs/heads/master 
from James Peach jpe...@apache.org
[ https://git-wip-us.apache.org/repos/asf?p=trafficserver.git;h=70e1088 ]

TS-1742: Re-enable 16 byte compare and swap by default


 Freelists to use 64bit version w/ Double Word Compare and Swap
 --

 Key: TS-1742
 URL: https://issues.apache.org/jira/browse/TS-1742
 Project: Traffic Server
  Issue Type: Improvement
Reporter: Brian Geffon
Assignee: Brian Geffon
 Fix For: 3.3.2

 Attachments: 128bit_cas.patch, 128bit_cas.patch.2


 So to those of you familiar with the freelists you know that it works this 
 way the head pointer uses the upper 16 bits for a version to prevent the ABA 
 problem. The big drawback to this is that it requires the following macros to 
 get at the pointer or the version:
 {code}
 #define FREELIST_POINTER(_x) ((void*)(intptr_t)(_x).data)16)16) | \
  (((~intptr_t)(_x).data)1663)-1))48)48)))  // sign extend
 #define FREELIST_VERSION(_x) (((intptr_t)(_x).data)48)
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
   (_x).data = intptr_t)(_p))0xULL) | (((_v)0xULL) 
  48))
 {code}
 Additionally, since this only leaves 16 bits it limits the number of versions 
 you can have, well more and more x86_64 processors support DCAS (double word 
 compare and swap / 128bit CAS). This means that we can use 64bits for a 
 version which basically makes the versions unlimited but more importantly it 
 takes those macros above and simplifies them to:
 {code}
 #define FREELIST_POINTER(_x) (_x).s.pointer
 #define FREELIST_VERSION(_x) (_x).s.version
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
 (_x).s.pointer = _p; (_x).s.version = _v
 {code}
 As you can imagine this will have a performance improvement, in my simple 
 tests I measured a performance improvement of around 6%. Unfortunately, I'm 
 not an expert with this stuff and I would really appreciate more community 
 feedback before I commit this patch.
 Note: this only applies if you're not using a reclaimable freelist.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (TS-1742) Freelists to use 64bit version w/ Double Word Compare and Swap

2013-03-21 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-1742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13609244#comment-13609244
 ] 

ASF subversion and git services commented on TS-1742:
-

Commit ae085945184c43195d825a6be72a259b84d9df33 in branch refs/heads/master 
from weijin taorui...@taobao.com
[ https://git-wip-us.apache.org/repos/asf?p=trafficserver.git;h=ae08594 ]

TS-1742 just make the regression test passed if cas128 enabled


 Freelists to use 64bit version w/ Double Word Compare and Swap
 --

 Key: TS-1742
 URL: https://issues.apache.org/jira/browse/TS-1742
 Project: Traffic Server
  Issue Type: Improvement
Reporter: Brian Geffon
Assignee: Brian Geffon
 Fix For: 3.3.2

 Attachments: 128bit_cas.patch, 128bit_cas.patch.2


 So to those of you familiar with the freelists you know that it works this 
 way the head pointer uses the upper 16 bits for a version to prevent the ABA 
 problem. The big drawback to this is that it requires the following macros to 
 get at the pointer or the version:
 {code}
 #define FREELIST_POINTER(_x) ((void*)(intptr_t)(_x).data)16)16) | \
  (((~intptr_t)(_x).data)1663)-1))48)48)))  // sign extend
 #define FREELIST_VERSION(_x) (((intptr_t)(_x).data)48)
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
   (_x).data = intptr_t)(_p))0xULL) | (((_v)0xULL) 
  48))
 {code}
 Additionally, since this only leaves 16 bits it limits the number of versions 
 you can have, well more and more x86_64 processors support DCAS (double word 
 compare and swap / 128bit CAS). This means that we can use 64bits for a 
 version which basically makes the versions unlimited but more importantly it 
 takes those macros above and simplifies them to:
 {code}
 #define FREELIST_POINTER(_x) (_x).s.pointer
 #define FREELIST_VERSION(_x) (_x).s.version
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
 (_x).s.pointer = _p; (_x).s.version = _v
 {code}
 As you can imagine this will have a performance improvement, in my simple 
 tests I measured a performance improvement of around 6%. Unfortunately, I'm 
 not an expert with this stuff and I would really appreciate more community 
 feedback before I commit this patch.
 Note: this only applies if you're not using a reclaimable freelist.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (TS-1742) Freelists to use 64bit version w/ Double Word Compare and Swap

2013-03-21 Thread Brian Geffon (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-1742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13609346#comment-13609346
 ] 

Brian Geffon commented on TS-1742:
--

Thanks for the help on this one everyone, I'm going to keep hacking away at 
this on the precise64 vagrant box until I can figure out what's going on then 
we'll try it again.

 Freelists to use 64bit version w/ Double Word Compare and Swap
 --

 Key: TS-1742
 URL: https://issues.apache.org/jira/browse/TS-1742
 Project: Traffic Server
  Issue Type: Improvement
Reporter: Brian Geffon
Assignee: Brian Geffon
 Fix For: 3.3.2

 Attachments: 128bit_cas.patch, 128bit_cas.patch.2


 So to those of you familiar with the freelists you know that it works this 
 way the head pointer uses the upper 16 bits for a version to prevent the ABA 
 problem. The big drawback to this is that it requires the following macros to 
 get at the pointer or the version:
 {code}
 #define FREELIST_POINTER(_x) ((void*)(intptr_t)(_x).data)16)16) | \
  (((~intptr_t)(_x).data)1663)-1))48)48)))  // sign extend
 #define FREELIST_VERSION(_x) (((intptr_t)(_x).data)48)
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
   (_x).data = intptr_t)(_p))0xULL) | (((_v)0xULL) 
  48))
 {code}
 Additionally, since this only leaves 16 bits it limits the number of versions 
 you can have, well more and more x86_64 processors support DCAS (double word 
 compare and swap / 128bit CAS). This means that we can use 64bits for a 
 version which basically makes the versions unlimited but more importantly it 
 takes those macros above and simplifies them to:
 {code}
 #define FREELIST_POINTER(_x) (_x).s.pointer
 #define FREELIST_VERSION(_x) (_x).s.version
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
 (_x).s.pointer = _p; (_x).s.version = _v
 {code}
 As you can imagine this will have a performance improvement, in my simple 
 tests I measured a performance improvement of around 6%. Unfortunately, I'm 
 not an expert with this stuff and I would really appreciate more community 
 feedback before I commit this patch.
 Note: this only applies if you're not using a reclaimable freelist.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (TS-1742) Freelists to use 64bit version w/ Double Word Compare and Swap

2013-03-12 Thread John Plevyak (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-1742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13600214#comment-13600214
 ] 

John Plevyak commented on TS-1742:
--

There are still a number of volatile declarations associated head_p, and
they need
to be made consistent.  Anyone with an ARM/i386 system want to do the
honors?

At the very least it looks like here and in ink_queue.h where head_p itself
is declared volatile.

john




 Freelists to use 64bit version w/ Double Word Compare and Swap
 --

 Key: TS-1742
 URL: https://issues.apache.org/jira/browse/TS-1742
 Project: Traffic Server
  Issue Type: Improvement
Reporter: Brian Geffon
Assignee: Brian Geffon
 Fix For: 3.3.2

 Attachments: 128bit_cas.patch, 128bit_cas.patch.2


 So to those of you familiar with the freelists you know that it works this 
 way the head pointer uses the upper 16 bits for a version to prevent the ABA 
 problem. The big drawback to this is that it requires the following macros to 
 get at the pointer or the version:
 {code}
 #define FREELIST_POINTER(_x) ((void*)(intptr_t)(_x).data)16)16) | \
  (((~intptr_t)(_x).data)1663)-1))48)48)))  // sign extend
 #define FREELIST_VERSION(_x) (((intptr_t)(_x).data)48)
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
   (_x).data = intptr_t)(_p))0xULL) | (((_v)0xULL) 
  48))
 {code}
 Additionally, since this only leaves 16 bits it limits the number of versions 
 you can have, well more and more x86_64 processors support DCAS (double word 
 compare and swap / 128bit CAS). This means that we can use 64bits for a 
 version which basically makes the versions unlimited but more importantly it 
 takes those macros above and simplifies them to:
 {code}
 #define FREELIST_POINTER(_x) (_x).s.pointer
 #define FREELIST_VERSION(_x) (_x).s.version
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
 (_x).s.pointer = _p; (_x).s.version = _v
 {code}
 As you can imagine this will have a performance improvement, in my simple 
 tests I measured a performance improvement of around 6%. Unfortunately, I'm 
 not an expert with this stuff and I would really appreciate more community 
 feedback before I commit this patch.
 Note: this only applies if you're not using a reclaimable freelist.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (TS-1742) Freelists to use 64bit version w/ Double Word Compare and Swap

2013-03-10 Thread John Plevyak (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-1742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13598350#comment-13598350
 ] 

John Plevyak commented on TS-1742:
--

Looks good.  I might consider adding an ink_debug_assert that the type_size for 
the freelist now be at least 16 bytes when this is enabled.

 Freelists to use 64bit version w/ Double Word Compare and Swap
 --

 Key: TS-1742
 URL: https://issues.apache.org/jira/browse/TS-1742
 Project: Traffic Server
  Issue Type: Improvement
Reporter: Brian Geffon
Assignee: Brian Geffon
 Attachments: 128bit_cas.patch, 128bit_cas.patch.2


 So to those of you familiar with the freelists you know that it works this 
 way the head pointer uses the upper 16 bits for a version to prevent the ABA 
 problem. The big drawback to this is that it requires the following macros to 
 get at the pointer or the version:
 {code}
 #define FREELIST_POINTER(_x) ((void*)(intptr_t)(_x).data)16)16) | \
  (((~intptr_t)(_x).data)1663)-1))48)48)))  // sign extend
 #define FREELIST_VERSION(_x) (((intptr_t)(_x).data)48)
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
   (_x).data = intptr_t)(_p))0xULL) | (((_v)0xULL) 
  48))
 {code}
 Additionally, since this only leaves 16 bits it limits the number of versions 
 you can have, well more and more x86_64 processors support DCAS (double word 
 compare and swap / 128bit CAS). This means that we can use 64bits for a 
 version which basically makes the versions unlimited but more importantly it 
 takes those macros above and simplifies them to:
 {code}
 #define FREELIST_POINTER(_x) (_x).s.pointer
 #define FREELIST_VERSION(_x) (_x).s.version
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
 (_x).s.pointer = _p; (_x).s.version = _v
 {code}
 As you can imagine this will have a performance improvement, in my simple 
 tests I measured a performance improvement of around 6%. Unfortunately, I'm 
 not an expert with this stuff and I would really appreciate more community 
 feedback before I commit this patch.
 Note: this only applies if you're not using a reclaimable freelist.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (TS-1742) Freelists to use 64bit version w/ Double Word Compare and Swap

2013-03-10 Thread JIRA

[ 
https://issues.apache.org/jira/browse/TS-1742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13598390#comment-13598390
 ] 

Igor Galić commented on TS-1742:


why not simply use {{uint16_t}} (or ) then?

 Freelists to use 64bit version w/ Double Word Compare and Swap
 --

 Key: TS-1742
 URL: https://issues.apache.org/jira/browse/TS-1742
 Project: Traffic Server
  Issue Type: Improvement
Reporter: Brian Geffon
Assignee: Brian Geffon
 Attachments: 128bit_cas.patch, 128bit_cas.patch.2


 So to those of you familiar with the freelists you know that it works this 
 way the head pointer uses the upper 16 bits for a version to prevent the ABA 
 problem. The big drawback to this is that it requires the following macros to 
 get at the pointer or the version:
 {code}
 #define FREELIST_POINTER(_x) ((void*)(intptr_t)(_x).data)16)16) | \
  (((~intptr_t)(_x).data)1663)-1))48)48)))  // sign extend
 #define FREELIST_VERSION(_x) (((intptr_t)(_x).data)48)
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
   (_x).data = intptr_t)(_p))0xULL) | (((_v)0xULL) 
  48))
 {code}
 Additionally, since this only leaves 16 bits it limits the number of versions 
 you can have, well more and more x86_64 processors support DCAS (double word 
 compare and swap / 128bit CAS). This means that we can use 64bits for a 
 version which basically makes the versions unlimited but more importantly it 
 takes those macros above and simplifies them to:
 {code}
 #define FREELIST_POINTER(_x) (_x).s.pointer
 #define FREELIST_VERSION(_x) (_x).s.version
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
 (_x).s.pointer = _p; (_x).s.version = _v
 {code}
 As you can imagine this will have a performance improvement, in my simple 
 tests I measured a performance improvement of around 6%. Unfortunately, I'm 
 not an expert with this stuff and I would really appreciate more community 
 feedback before I commit this patch.
 Note: this only applies if you're not using a reclaimable freelist.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (TS-1742) Freelists to use 64bit version w/ Double Word Compare and Swap

2013-03-10 Thread weijin (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-1742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13598486#comment-13598486
 ] 

weijin commented on TS-1742:


should we remove the volatile keyword in head_p structure ? It seems useless 
but generating slow assembly instructions.

 Freelists to use 64bit version w/ Double Word Compare and Swap
 --

 Key: TS-1742
 URL: https://issues.apache.org/jira/browse/TS-1742
 Project: Traffic Server
  Issue Type: Improvement
Reporter: Brian Geffon
Assignee: Brian Geffon
 Attachments: 128bit_cas.patch, 128bit_cas.patch.2


 So to those of you familiar with the freelists you know that it works this 
 way the head pointer uses the upper 16 bits for a version to prevent the ABA 
 problem. The big drawback to this is that it requires the following macros to 
 get at the pointer or the version:
 {code}
 #define FREELIST_POINTER(_x) ((void*)(intptr_t)(_x).data)16)16) | \
  (((~intptr_t)(_x).data)1663)-1))48)48)))  // sign extend
 #define FREELIST_VERSION(_x) (((intptr_t)(_x).data)48)
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
   (_x).data = intptr_t)(_p))0xULL) | (((_v)0xULL) 
  48))
 {code}
 Additionally, since this only leaves 16 bits it limits the number of versions 
 you can have, well more and more x86_64 processors support DCAS (double word 
 compare and swap / 128bit CAS). This means that we can use 64bits for a 
 version which basically makes the versions unlimited but more importantly it 
 takes those macros above and simplifies them to:
 {code}
 #define FREELIST_POINTER(_x) (_x).s.pointer
 #define FREELIST_VERSION(_x) (_x).s.version
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
 (_x).s.pointer = _p; (_x).s.version = _v
 {code}
 As you can imagine this will have a performance improvement, in my simple 
 tests I measured a performance improvement of around 6%. Unfortunately, I'm 
 not an expert with this stuff and I would really appreciate more community 
 feedback before I commit this patch.
 Note: this only applies if you're not using a reclaimable freelist.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (TS-1742) Freelists to use 64bit version w/ Double Word Compare and Swap

2013-03-10 Thread Brian Geffon (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-1742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13598489#comment-13598489
 ] 

Brian Geffon commented on TS-1742:
--

hey weijin, you're saying that volatile is not required because we're doing the 
CAS anyway? The only issue with that is when you reload couldn't you possibly 
get stuck in an infinite loop of compare and swaps if the load was optimized 
away because there wasn't the volatile keyword?

You guys definitely know the freelist stuff better than me, so if you think 
it's safe to take out I'll definitely do it.



 Freelists to use 64bit version w/ Double Word Compare and Swap
 --

 Key: TS-1742
 URL: https://issues.apache.org/jira/browse/TS-1742
 Project: Traffic Server
  Issue Type: Improvement
Reporter: Brian Geffon
Assignee: Brian Geffon
 Attachments: 128bit_cas.patch, 128bit_cas.patch.2


 So to those of you familiar with the freelists you know that it works this 
 way the head pointer uses the upper 16 bits for a version to prevent the ABA 
 problem. The big drawback to this is that it requires the following macros to 
 get at the pointer or the version:
 {code}
 #define FREELIST_POINTER(_x) ((void*)(intptr_t)(_x).data)16)16) | \
  (((~intptr_t)(_x).data)1663)-1))48)48)))  // sign extend
 #define FREELIST_VERSION(_x) (((intptr_t)(_x).data)48)
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
   (_x).data = intptr_t)(_p))0xULL) | (((_v)0xULL) 
  48))
 {code}
 Additionally, since this only leaves 16 bits it limits the number of versions 
 you can have, well more and more x86_64 processors support DCAS (double word 
 compare and swap / 128bit CAS). This means that we can use 64bits for a 
 version which basically makes the versions unlimited but more importantly it 
 takes those macros above and simplifies them to:
 {code}
 #define FREELIST_POINTER(_x) (_x).s.pointer
 #define FREELIST_VERSION(_x) (_x).s.version
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
 (_x).s.pointer = _p; (_x).s.version = _v
 {code}
 As you can imagine this will have a performance improvement, in my simple 
 tests I measured a performance improvement of around 6%. Unfortunately, I'm 
 not an expert with this stuff and I would really appreciate more community 
 feedback before I commit this patch.
 Note: this only applies if you're not using a reclaimable freelist.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (TS-1742) Freelists to use 64bit version w/ Double Word Compare and Swap

2013-03-10 Thread John Plevyak (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-1742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13598501#comment-13598501
 ] 

John Plevyak commented on TS-1742:
--

We can take it out because we do the loads manually for the cas.

I always liked to use volatile as a marker that the variable was being
accessed outside
of a lock, but if it is causing a performance problem then we could convert
the keyword
into a comment:

// Warning: this variable is read and written in multiple threads without a
lock, use INK_QUEUE_LD to read safely.

john




 Freelists to use 64bit version w/ Double Word Compare and Swap
 --

 Key: TS-1742
 URL: https://issues.apache.org/jira/browse/TS-1742
 Project: Traffic Server
  Issue Type: Improvement
Reporter: Brian Geffon
Assignee: Brian Geffon
 Attachments: 128bit_cas.patch, 128bit_cas.patch.2


 So to those of you familiar with the freelists you know that it works this 
 way the head pointer uses the upper 16 bits for a version to prevent the ABA 
 problem. The big drawback to this is that it requires the following macros to 
 get at the pointer or the version:
 {code}
 #define FREELIST_POINTER(_x) ((void*)(intptr_t)(_x).data)16)16) | \
  (((~intptr_t)(_x).data)1663)-1))48)48)))  // sign extend
 #define FREELIST_VERSION(_x) (((intptr_t)(_x).data)48)
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
   (_x).data = intptr_t)(_p))0xULL) | (((_v)0xULL) 
  48))
 {code}
 Additionally, since this only leaves 16 bits it limits the number of versions 
 you can have, well more and more x86_64 processors support DCAS (double word 
 compare and swap / 128bit CAS). This means that we can use 64bits for a 
 version which basically makes the versions unlimited but more importantly it 
 takes those macros above and simplifies them to:
 {code}
 #define FREELIST_POINTER(_x) (_x).s.pointer
 #define FREELIST_VERSION(_x) (_x).s.version
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
 (_x).s.pointer = _p; (_x).s.version = _v
 {code}
 As you can imagine this will have a performance improvement, in my simple 
 tests I measured a performance improvement of around 6%. Unfortunately, I'm 
 not an expert with this stuff and I would really appreciate more community 
 feedback before I commit this patch.
 Note: this only applies if you're not using a reclaimable freelist.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (TS-1742) Freelists to use 64bit version w/ Double Word Compare and Swap

2013-03-10 Thread weijin (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-1742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13598518#comment-13598518
 ] 

weijin commented on TS-1742:


Brian, John, I did a test, the size of assembly codes of ink_freelist_* 
function dropped 30%~40% if we removed the volatile in gcc version 4.4.1 



 Freelists to use 64bit version w/ Double Word Compare and Swap
 --

 Key: TS-1742
 URL: https://issues.apache.org/jira/browse/TS-1742
 Project: Traffic Server
  Issue Type: Improvement
Reporter: Brian Geffon
Assignee: Brian Geffon
 Attachments: 128bit_cas.patch, 128bit_cas.patch.2


 So to those of you familiar with the freelists you know that it works this 
 way the head pointer uses the upper 16 bits for a version to prevent the ABA 
 problem. The big drawback to this is that it requires the following macros to 
 get at the pointer or the version:
 {code}
 #define FREELIST_POINTER(_x) ((void*)(intptr_t)(_x).data)16)16) | \
  (((~intptr_t)(_x).data)1663)-1))48)48)))  // sign extend
 #define FREELIST_VERSION(_x) (((intptr_t)(_x).data)48)
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
   (_x).data = intptr_t)(_p))0xULL) | (((_v)0xULL) 
  48))
 {code}
 Additionally, since this only leaves 16 bits it limits the number of versions 
 you can have, well more and more x86_64 processors support DCAS (double word 
 compare and swap / 128bit CAS). This means that we can use 64bits for a 
 version which basically makes the versions unlimited but more importantly it 
 takes those macros above and simplifies them to:
 {code}
 #define FREELIST_POINTER(_x) (_x).s.pointer
 #define FREELIST_VERSION(_x) (_x).s.version
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
 (_x).s.pointer = _p; (_x).s.version = _v
 {code}
 As you can imagine this will have a performance improvement, in my simple 
 tests I measured a performance improvement of around 6%. Unfortunately, I'm 
 not an expert with this stuff and I would really appreciate more community 
 feedback before I commit this patch.
 Note: this only applies if you're not using a reclaimable freelist.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (TS-1742) Freelists to use 64bit version w/ Double Word Compare and Swap

2013-03-10 Thread Brian Geffon (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-1742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13598525#comment-13598525
 ] 

Brian Geffon commented on TS-1742:
--

Sounds like a no brainer, I'll get it removed with this commit. Thanks Weijin!

 Freelists to use 64bit version w/ Double Word Compare and Swap
 --

 Key: TS-1742
 URL: https://issues.apache.org/jira/browse/TS-1742
 Project: Traffic Server
  Issue Type: Improvement
Reporter: Brian Geffon
Assignee: Brian Geffon
 Attachments: 128bit_cas.patch, 128bit_cas.patch.2


 So to those of you familiar with the freelists you know that it works this 
 way the head pointer uses the upper 16 bits for a version to prevent the ABA 
 problem. The big drawback to this is that it requires the following macros to 
 get at the pointer or the version:
 {code}
 #define FREELIST_POINTER(_x) ((void*)(intptr_t)(_x).data)16)16) | \
  (((~intptr_t)(_x).data)1663)-1))48)48)))  // sign extend
 #define FREELIST_VERSION(_x) (((intptr_t)(_x).data)48)
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
   (_x).data = intptr_t)(_p))0xULL) | (((_v)0xULL) 
  48))
 {code}
 Additionally, since this only leaves 16 bits it limits the number of versions 
 you can have, well more and more x86_64 processors support DCAS (double word 
 compare and swap / 128bit CAS). This means that we can use 64bits for a 
 version which basically makes the versions unlimited but more importantly it 
 takes those macros above and simplifies them to:
 {code}
 #define FREELIST_POINTER(_x) (_x).s.pointer
 #define FREELIST_VERSION(_x) (_x).s.version
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
 (_x).s.pointer = _p; (_x).s.version = _v
 {code}
 As you can imagine this will have a performance improvement, in my simple 
 tests I measured a performance improvement of around 6%. Unfortunately, I'm 
 not an expert with this stuff and I would really appreciate more community 
 feedback before I commit this patch.
 Note: this only applies if you're not using a reclaimable freelist.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira