<div dir="ltr">Actually, it was reverted and I re-landed the change as D28586 after this bug fix D28577.<div><br></div><div>You mean, the test verifying that quarantine is, in fact, bypassed? Not right away, but I'll think about it.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 10, 2017 at 4:41 PM, Kostya Serebryany <span dir="ltr"><<a href="mailto:kcc@google.com" target="_blank">kcc@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">is a test possible here? </div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 9, 2017 at 3:49 PM, Alex Shlyapnikov via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: alekseyshl<br>
Date: Mon Jan  9 17:49:15 2017<br>
New Revision: 291510<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=291510&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=291510&view=rev</a><br>
Log:<br>
Bypass quarantine when quarantine size is set ot zero.<br>
<br>
Modified:<br>
    compiler-rt/trunk/lib/sanitize<wbr>r_common/sanitizer_quarantine.<wbr>h<br>
<br>
Modified: compiler-rt/trunk/lib/sanitize<wbr>r_common/sanitizer_quarantine.<wbr>h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_quarantine.h?rev=291510&r1=291509&r2=291510&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/compiler-rt/trunk/lib/sa<wbr>nitizer_common/sanitizer_quara<wbr>ntine.h?rev=291510&r1=291509&<wbr>r2=291510&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- compiler-rt/trunk/lib/sanitize<wbr>r_common/sanitizer_quarantine.<wbr>h (original)<br>
+++ compiler-rt/trunk/lib/sanitize<wbr>r_common/sanitizer_quarantine.<wbr>h Mon Jan  9 17:49:15 2017<br>
@@ -49,6 +49,10 @@ class Quarantine {<br>
   }<br>
<br>
   void Init(uptr size, uptr cache_size) {<br>
+    // Thread local quarantine size can be zero only when global quarantine size<br>
+    // is zero (it allows us to perform just one atomic read per Put() call).<br>
+    CHECK((size == 0 && cache_size == 0) || cache_size != 0);<br>
+<br>
     atomic_store(&max_size_, size, memory_order_relaxed);<br>
     atomic_store(&min_size_, size / 10 * 9,<br>
                  memory_order_relaxed);  // 90% of max size.<br>
@@ -61,8 +65,15 @@ class Quarantine {<br>
   }<br>
<br>
   void Put(Cache *c, Callback cb, Node *ptr, uptr size) {<br>
-    c->Enqueue(cb, ptr, size);<br>
-    if (c->Size() > GetCacheSize())<br>
+    uptr cache_size = GetCacheSize();<br>
+    if (cache_size) {<br>
+      c->Enqueue(cb, ptr, size);<br>
+    } else {<br>
+      // cache_size == 0 only when size == 0 (see Init).<br>
+      cb.Recycle(ptr);<br>
+    }<br>
+    // Check cache size anyway to accommodate for runtime cache_size change.<br>
+    if (c->Size() > cache_size)<br>
       Drain(c, cb);<br>
   }<br>
<br>
@@ -207,6 +218,7 @@ class QuarantineCache {<br>
     return b;<br>
   }<br>
 };<br>
+<br>
 } // namespace __sanitizer<br>
<br>
 #endif // SANITIZER_QUARANTINE_H<br>
<br>
<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>