<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 19, 2016 at 10:49 AM, Rong Xu <span dir="ltr"><<a href="mailto:xur@google.com">xur@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">xur added a comment.<br>
<br>
The eviction method is good. My concerns is we don't using lock in this function, there are chances of corrupted data in threaded programs. This eviction mechanism seems to increase the chances. And previously the corruption will only be count values. Now it could be targets. </blockquote><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"> I would suggest to use atomic in setting the target when replacing.<br></blockquote><div><br></div><div> Target setting is just a store -- so it should be fine.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<br>
Another related question: The counter allocation uses atomic operation. Why not the counter updates also using atomic?<br></blockquote><div><br></div><div>The consideration is different. For counter update, not using atomic only leads to small precision loss, but for allocation, it is important to use atomic update to avoid leaks/corrupted data structure.   Another reason is that counter update is much more frequent than counter allocation so the choice also has  performance reason.</div><div><br></div><div>David</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<br>
-Rong<br>
<br>
<br>
<a href="http://reviews.llvm.org/D20408" rel="noreferrer">http://reviews.llvm.org/D20408</a><br>
<br>
<br>
<br>
</blockquote></div><br></div></div>