Re: RFR (XS) CR 8014233: java.lang.Thread should be @Contended

2013-05-10 Thread Aleksey Shipilev
On 05/10/2013 05:27 PM, Aleksey Shipilev wrote: > Although I just tried what Peter had suggested, and got even more > boost on my microbenchmark. This counter-intuitive for me, since no > memory layout differences could explain this in my tests. I will have > to untangle this today, hold on. Ok, I

Re: RFR (XS) CR 8014233: java.lang.Thread should be @Contended

2013-05-10 Thread Aleksey Shipilev
On 10.05.2013, at 16:17, Doug Lea wrote: > On 05/09/13 10:19, Peter Levart wrote: >> Hi Aleksey, >> >> Wouldn't it be even better if just threadLocalRandom* fields were annotated >> with >> @Contended("ThreadLocal") ? >> Some fields within the Thread object are accessed from non-local threads.

Re: RFR (XS) CR 8014233: java.lang.Thread should be @Contended

2013-05-10 Thread Doug Lea
On 05/10/13 02:31, Laurent Bourgès wrote: Peter, you're absolutely right: I was thinking about thread local values (object instances) and not ThreadLocal keys ! I think ThreadLocal name is confusing as it does not correspond to values ! Several times I wonder if false sharing can happen between

Re: RFR (XS) CR 8014233: java.lang.Thread should be @Contended

2013-05-10 Thread Doug Lea
On 05/09/13 10:19, Peter Levart wrote: Hi Aleksey, Wouldn't it be even better if just threadLocalRandom* fields were annotated with @Contended("ThreadLocal") ? Some fields within the Thread object are accessed from non-local threads. I don't know how frequently, but isolating just threadLocalRan

Re: RFR (XS) CR 8014233: java.lang.Thread should be @Contended

2013-05-09 Thread Laurent Bourgès
Peter, you're absolutely right: I was thinking about thread local values (object instances) and not ThreadLocal keys ! I think ThreadLocal name is confusing as it does not correspond to values ! Several times I wonder if false sharing can happen between my thread local values (i.e. different Thre

Re: RFR (XS) CR 8014233: java.lang.Thread should be @Contended

2013-05-09 Thread Peter Levart
On 05/09/2013 04:59 PM, Laurent Bourgès wrote: Hi all, A stupid question: any ThreadLocal subclass should be marked @Contended to be sure that false sharing never happens between ThreadLocal instance and any other object on the heap ? Hi Laurent, ThreadLocal object is just a key (into a

Re: RFR (XS) CR 8014233: java.lang.Thread should be @Contended

2013-05-09 Thread Laurent Bourgès
Hi all, A stupid question: any ThreadLocal subclass should be marked @Contended to be sure that false sharing never happens between ThreadLocal instance and any other object on the heap ? Laurent 2013/5/9 Peter Levart > Hi Aleksey, > > Wouldn't it be even better if just threadLocalRandom* fiel

Re: RFR (XS) CR 8014233: java.lang.Thread should be @Contended

2013-05-09 Thread Peter Levart
Hi Aleksey, Wouldn't it be even better if just threadLocalRandom* fields were annotated with @Contended("ThreadLocal") ? Some fields within the Thread object are accessed from non-local threads. I don't know how frequently, but isolating just threadLocalRandom* fields from all possible false-s

Re: RFR (XS) CR 8014233: java.lang.Thread should be @Contended

2013-05-09 Thread Doug Lea
On 05/09/13 05:39, David Holmes wrote: Hi Aleksey Well the code change is easy enough to review :) As to the effects ... no way to judge that: time and testing will tell. For some initial sanity-check testing, I just built lambda with the added @Contended annotation on Thread and ran a few o

Re: RFR (XS) CR 8014233: java.lang.Thread should be @Contended

2013-05-09 Thread Aleksey Shipilev
On 05/09/2013 02:15 PM, David Holmes wrote: > On 9/05/2013 7:53 PM, Aleksey Shipilev wrote: >> On 05/09/2013 01:39 PM, David Holmes wrote: >>> Well the code change is easy enough to review :) >> >> Ha! Bike-shed opportunity: to use fully quailified class name in the >> annotation, or not. (I'm foll

Re: RFR (XS) CR 8014233: java.lang.Thread should be @Contended

2013-05-09 Thread David Holmes
On 9/05/2013 7:53 PM, Aleksey Shipilev wrote: On 05/09/2013 01:39 PM, David Holmes wrote: Well the code change is easy enough to review :) Ha! Bike-shed opportunity: to use fully quailified class name in the annotation, or not. (I'm following the suit for j.u.c.ForkJoinPool and friends). As

Re: RFR (XS) CR 8014233: java.lang.Thread should be @Contended

2013-05-09 Thread Aleksey Shipilev
On 05/09/2013 01:39 PM, David Holmes wrote: > Well the code change is easy enough to review :) Ha! Bike-shed opportunity: to use fully quailified class name in the annotation, or not. (I'm following the suit for j.u.c.ForkJoinPool and friends). > As to the effects ... no way to judge that: time a

Re: RFR (XS) CR 8014233: java.lang.Thread should be @Contended

2013-05-09 Thread David Holmes
Hi Aleksey Well the code change is easy enough to review :) As to the effects ... no way to judge that: time and testing will tell. David On 9/05/2013 3:29 AM, Aleksey Shipilev wrote: Hi, This is from our backlog after JDK-8005926. After ThreadLocalRandom state was merged into Thread, we now

RFR (XS) CR 8014233: java.lang.Thread should be @Contended

2013-05-08 Thread Aleksey Shipilev
Hi, This is from our backlog after JDK-8005926. After ThreadLocalRandom state was merged into Thread, we now have to deal with the false sharing induced by heavily-updated fields in Thread. TLR was padded before, and it should make sense to make Thread bear @Contended annotation to isolate its fie