[PATCH] D35358: [scudo] Do not grab a cache for secondary allocation & per related changes

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 13 08:24:15 PDT 2017


cryptoad created this revision.

Secondary backed allocations do not require a cache. While it's not necessary
an issue when each thread has its cache, it becomes one with a shared pool of
caches (Android), as a Secondary backed allocation or deallocation holds a
cache that could be useful to another thread doing a Primary backed allocation.

We introduce an additional PRNG and its mutex (to avoid contention with the
Fallback one for Primary allocations) that will provide the `Salt` needed for
Secondary backed allocations.

I changed some of the code in a way that feels more readable to me (eg: using
some values directly rather than going  through ternary assigned variables,
using directly `true`/`false` rather than `FromPrimary`). I will let reviewers
decide if it actually is.

An additional change is to mark `CheckForCallocOverflow` as `UNLIKELY`.


https://reviews.llvm.org/D35358

Files:
  lib/scudo/scudo_allocator.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35358.106430.patch
Type: text/x-patch
Size: 6227 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170713/f9acd01f/attachment.bin>


More information about the llvm-commits mailing list