Ayumi Ono would like Benoit Lize, Stephen Nusko, Chromium LUCI CQ, Eriko Kurimoto, Mikihito Matsuura and Rubber Stamper to review this change.
Reland "PA: Support multiple ThreadCache instances per thread."
This reverts commit 101ec6b775b79e6a644521d9213b3225237a1ee1.
Reason for revert: fixed
Original change's description:
> Revert "PA: Support multiple ThreadCache instances per thread."
>
> This reverts commit d7bfc3c111e238f13ccc81110cb8550cccb5a6a3.
>
> Reason for revert: Culprit of the wide-spread breakage of
> AlternateBucketDistributionAndPartitionFreeList*
>
> Example failure log:
> https://ci.chromium.org/ui/p/chromium/builders/ci/linux-chromeos-dbg/43949/overview
>
> Original change's description:
> > PA: Support multiple ThreadCache instances per thread.
> >
> > Currently, each thread only supports a single ThreadCache, which is
> > exclusively used by the default partition. This limitation hinders
> > security improvements that involve splitting the default partition into
> > several smaller partitions, as it leads to performance regressions due
> > to the lack of a thread cache for these new partitions.
> >
> > The design document is available in
> > https://docs.google.com/document/d/17wkGZ3ekQoirb0--kls-Sblr5qRSjtZ0VjtuJ5WIPH8/edit?usp=sharing
> > (internal only).
> >
> > This change introduces support for multiple `ThreadCache` instances per
> > thread. The number of thread caches is configured at compile time. These
> > caches are managed using:
> > - An array of `ThreadCache*` in `thread_local`.
> > - An array of `ThreadCache` within `PartitionTLS`.
> >
> > For `PartitionTLS`, an additional check ensures each `ThreadCache` is
> > properly initialized, as thread caches from different roots are created
> > at different times. The `IsTombstone` function has also been modified to
> > check against the entire thread's state rather than requiring a specific
> > `ThreadCache` pointer, since all thread caches for a given thread are
> > destroyed simultaneously.
> >
> > Note that additional testing, especially in `thread_cache_unittest.cc`,
> > will be added in a subsequent CL.
> >
> > Bug: 467243745
> > Change-Id: I217215f6db648ffba2f7313af2bdb546e36f6fe1
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7206958
> > Auto-Submit: Ayumi Ono <ayum...@google.com>
> > Reviewed-by: Benoit Lize <li...@chromium.org>
> > Commit-Queue: Ayumi Ono <ayum...@google.com>
> > Cr-Commit-Position: refs/heads/main@{#1568807}
>
> Bug: 467243745
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Change-Id: I8263c8be7b03694fefa6985609a230b62fc481a5
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7458168
> Commit-Queue: Rubber Stamper <rubber-...@appspot.gserviceaccount.com>
> Auto-Submit: Eriko Kurimoto <elk...@chromium.org>
> Owners-Override: Eriko Kurimoto <elk...@chromium.org>
> Bot-Commit: Rubber Stamper <rubber-...@appspot.gserviceaccount.com>
> Cr-Commit-Position: refs/heads/main@{#1568894}
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Bot-Commit | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Gerrit GetPureRevert API does not mark this CL as a pure revert. Learn more: go/rubber-stamper-user-guide.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
Reason for revert: fixedCan you expand on this? What did you change? Which patchset to diff to see the changes from the original?
opts.thread_cache_index = internal::kDefaultRootThreadCacheIndex;I think this is the change?
options.thread_cache_index = 0;This is just a magic number, could you either
1) Add a comment explaining why zero
2) Add a descriptively named variable set to zero and use that?
---------------------------
Optional further thought:
Also this is sort of hard for future users to know how to pick this value, obviously here they don't have PA-E, and the point is this is all known at compile time but perhaps we should have a `partition_alloc::GetNextAvailableThreadCacheIndex(partiton_alloc::ThreadCache::FastMalloc)`?
And then we explicitly enumerate all allowed usages and pass the correct values? This might make it be very clear what you need to do to add a new PartitionRoot with a thread cache.
Again this second half is completely optional, for this CL feel free to just add a comment about the zero or a named variable.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +1 |
Can you expand on this? What did you change? Which patchset to diff to see the changes from the original?
Done
opts.thread_cache_index = internal::kDefaultRootThreadCacheIndex;I think this is the change?
Yes
This is just a magic number, could you either
1) Add a comment explaining why zero
2) Add a descriptively named variable set to zero and use that?---------------------------
Optional further thought:
Also this is sort of hard for future users to know how to pick this value, obviously here they don't have PA-E, and the point is this is all known at compile time but perhaps we should have a `partition_alloc::GetNextAvailableThreadCacheIndex(partiton_alloc::ThreadCache::FastMalloc)`?
And then we explicitly enumerate all allowed usages and pass the correct values? This might make it be very clear what you need to do to add a new PartitionRoot with a thread cache.
Again this second half is completely optional, for this CL feel free to just add a comment about the zero or a named variable.
I fixed to use `partition_alloc::internal::kDefaultRootThreadCacheIndex`.
About the second half, it makes sense, but I think it's not feasible because the thread index occupation is different per threads and time; the default partition's thread_cache is currently configured during initialization, and not always configured.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +1 |
PTAL
Patch 1 was already approved in "PA: Support multiple ThreadCache instances per thread". Patch 2 and 5 add new changes.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |