[PATCH] D37590: [scudo] RFC thread specific data refactoring

Dmitry Vyukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 12 01:34:16 PDT 2017


dvyukov added inline comments.


================
Comment at: lib/scudo/scudo_allocator.cpp:255
 
-AllocatorCache *getAllocatorCache(ScudoThreadContext *ThreadContext) {
-  return &ThreadContext->Cache;
+AllocatorCache *getAllocatorCache(ScudoTSD *TSD) {
+  return &TSD->Cache;
----------------
This and getPrng look unnecessary now.


================
Comment at: lib/scudo/scudo_allocator.cpp:385
+      ScudoTSD *TSD = getTSDAndLock();
+      if (LIKELY(TSD)) {
+        Salt = getPrng(TSD)->getU8();
----------------
It feels that in this new model getTSDAndLock() should just never return NULL. If some TSD implementation can't return a thread-local descriptor, it should be _its_ problem to allocate and return a fallback descriptor instead. Since we now have a notion of getTSDAndLock()/TSD->unlock(), global mutex-protected fallback descriptor fits into into this model well.
But the "global hashed set of TSDs" implementation just does not have this problem.


================
Comment at: lib/scudo/scudo_tsd.h:27
+
+#if !SCUDO_TSD_EXCLUSIVE
+struct ScudoTSDPlatform {
----------------
I think this file and the cc will be much easier to understand if split into multiple files (one per model).


https://reviews.llvm.org/D37590





More information about the llvm-commits mailing list