<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
- I think CMSCollector::_eden_chunk_<u></u>sampling_active should be volatile<br>
to avoid any clever compilers skipping the read in sample_eden_chunk().<br>
(Although I don't think it's possible here). See also below for avoiding<br>
that variable completely.<br>
</blockquote>
Could you explain you thinking for making it volatile. As you have, I<br>
didn't think<br>
it was necessary and thought ,"If not necessary, don't do it".<br>
</blockquote>
It's not necessary I think, just as a reminder to the compiler to not<br>
optimize that load away. I think the Atomic instruction contain the<br>
necessary instructions though.<br>
</blockquote>
<br></div></div>
Ok. I might be a bit of a distraction to include volatile when<br>
not necessary.</blockquote><div><br></div><div>I haven't thought about this volatile thing too much. But it seems unnecessary, even if we keep this <span style="color:rgb(80,0,80)">_eden_chunk_</span><u style="color:rgb(80,0,80)"></u><span style="color:rgb(80,0,80)">samp</span><span style="color:rgb(80,0,80)">ling_active, as opposed to using try_lock() which I haven't thought about yet.</span></div>
</div></div></div>