--
You received this message because you are subscribed to the Google Groups "Project TRIM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-trim+unsubscribe@chromium.org.
To post to this group, send email to projec...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/project-trim/CAOuvq205iEQ6oUD9PSCbCBask6rWubsW5jX2PTi1FRttMt_Q2g%40mail.gmail.com.
PartitionAlloc everywhere is my dream (even though we cannot replace memory allocators used by some Android vendors).The plan looks good to me :)
On Thu, Nov 3, 2016 at 5:20 AM, Chris Palmer <pal...@chromium.org> wrote:
Hi all,jschuh tasked me with seeing if we can use PartitionAlloc in more places throughout Chromium, not just in Blink. Additionally, we'd like to (try to) harden it further, repair some hardening regressions while not regressing performance, and maybe even use PA everywhere, instead of tcmalloc.I wrote up a draft of a plan, which you can see and comment on here:I appreciate your feedback and clues!
--
You received this message because you are subscribed to the Google Groups "Project TRIM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-trim...@chromium.org.
To post to this group, send email to projec...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/project-trim/CAOuvq205iEQ6oUD9PSCbCBask6rWubsW5jX2PTi1FRttMt_Q2g%40mail.gmail.com.
--Kentaro Hara, Tokyo, Japan
--
You received this message because you are subscribed to the Google Groups "Project TRIM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-trim...@chromium.org.
To post to this group, send email to projec...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/project-trim/CABg10jxquP9zJPGrgR_u0Rm2_uTUNiizWA_CuOBwp5Lo57%3DoAg%40mail.gmail.com.
- I think the right model is to NOT replace the default allocator but make PA something you can opt-in on a per-class basis similarly to what happens in blink with the WTF_MAKE_FAST_ALLOCATED macro. The reason of this is:
2) It has been a long time since I looked into PA, but IIRC it is extremely optimized for single threaded scenarios, but just takes a spinlock on MT. It works great for blink but I am not sure will work great *everywhere* in the browser process.
This sounds like a great plan, looking forward to having PA available in more places.
--
You received this message because you are subscribed to the Google Groups "platform-architecture-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to platform-architecture-dev+unsub...@chromium.org.
To post to this group, send email to platform-architecture-dev@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/platform-architecture-dev/CABg10jwUqSE7eAfe0-7-F5%3DYFrZ2cczuGwXKFuqtD4VHDezGoQ%40mail.gmail.com.
Though I want to aim at PartitionAlloc everywhere in the end :)
Even if PartitionAlloc does not give us a clear performance/memory win compared to tcmalloc, it's still a big win for the following reasons:- PartitionAlloc is more secure.
- PartitionAlloc provides a detailed profiling info including object types. Replacing tcmalloc with PartitionAlloc improves our profiling tool chain.
However, I do agree that we should proceed with the replacement incrementally by adding USING_FAST_MALLOC() macros to a certain set of classes. To get good performance from PartitionAlloc, it is very important that objects are classified into partitions properly. if you simply put all objects in one partition, you won't be able to get good performance. For example, we confirmed that mixing content/ objects and Blink objects in one partition regresses performance. So I'd suggest introducing USING_FAST_MALLOC() macros to Skia, CC, V8 etc and move them to dedicated partitions incrementally.
On Fri, Nov 4, 2016 at 9:32 AM, Chris Palmer <pal...@chromium.org> wrote:On Thu, Nov 3, 2016 at 11:16 AM, Primiano Tucci <prim...@chromium.org> wrote:- I think the right model is to NOT replace the default allocator but make PA something you can opt-in on a per-class basis similarly to what happens in blink with the WTF_MAKE_FAST_ALLOCATED macro. The reason of this is:I agree. I don't think really can be a one-size-fits-all allocator, especially given the necessary trade-offs related to concurrency.2) It has been a long time since I looked into PA, but IIRC it is extremely optimized for single threaded scenarios, but just takes a spinlock on MT. It works great for blink but I am not sure will work great *everywhere* in the browser process.Correct, and I agree.But, if people have ideas where they'd like to use PA for either performance or safety reasons, please comment in the document. Thanks!--Kentaro Hara, Tokyo, Japan
--
You received this message because you are subscribed to the Google Groups "Project TRIM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-trim...@chromium.org.
To post to this group, send email to projec...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/project-trim/CABg10jwUqSE7eAfe0-7-F5%3DYFrZ2cczuGwXKFuqtD4VHDezGoQ%40mail.gmail.com.
On Fri, Nov 4, 2016 at 5:30 AM Kentaro Hara <har...@chromium.org> wrote:Though I want to aim at PartitionAlloc everywhere in the end :)I will be very happy if we get to that state. I am just saying that I think that the right way to get there is to NOT just replace the default malloc() with PA.That is dangerous stability-wise and will force to put everything into one partition, which is likely to not "just work" perf-wise as discussed above.My feeling is that the right long-term solution will be to identify the right set of partitions like it happened in blink and opting-in the right code in the right partition.I know that this is more work than just replacing malloc. On the good side this is: 1) safer; 2) incremental, allowing to get data and reason on a case-per case basis. 3) distributable over teams. Once we get to a state where PA is in base and people can easily opt-in by just putting a macro it can become other people's responsibility to drive the rest of the migration.> - Removing tcmalloc reduces # of allocators in the system.I think that an acceptable solution could be getting to a state where things are either PAlloced or glibc-malloc-ed (without tcmalloc).After the work on the shim things like suicide-on-OOM are not allocator-specific anymore and happen at the shim level.Here's the question for the security experts: are there other properties other than suicide-on-OOM and int32 wrapping (no >4GB allocations) that make the current tcmalloc secure?In other words, if we get to a state where things are either PA-allocted or glibc-alloced + the two aforementioned checks above would that be a security regression? Or are the remaining tcmalloc benefit purely related to performance?
Even if PartitionAlloc does not give us a clear performance/memory win compared to tcmalloc, it's still a big win for the following reasons:- PartitionAlloc is more secure.- PartitionAlloc provides a detailed profiling info including object types. Replacing tcmalloc with PartitionAlloc improves our profiling tool chain.However, I do agree that we should proceed with the replacement incrementally by adding USING_FAST_MALLOC() macros to a certain set of classes. To get good performance from PartitionAlloc, it is very important that objects are classified into partitions properly. if you simply put all objects in one partition, you won't be able to get good performance. For example, we confirmed that mixing content/ objects and Blink objects in one partition regresses performance. So I'd suggest introducing USING_FAST_MALLOC() macros to Skia, CC, V8 etc and move them to dedicated partitions incrementally.Yup these are all great arguments which I fully agree on.
On Fri, Nov 4, 2016 at 9:32 AM, Chris Palmer <pal...@chromium.org> wrote:On Thu, Nov 3, 2016 at 11:16 AM, Primiano Tucci <prim...@chromium.org> wrote:- I think the right model is to NOT replace the default allocator but make PA something you can opt-in on a per-class basis similarly to what happens in blink with the WTF_MAKE_FAST_ALLOCATED macro. The reason of this is:I agree. I don't think really can be a one-size-fits-all allocator, especially given the necessary trade-offs related to concurrency.2) It has been a long time since I looked into PA, but IIRC it is extremely optimized for single threaded scenarios, but just takes a spinlock on MT. It works great for blink but I am not sure will work great *everywhere* in the browser process.Correct, and I agree.But, if people have ideas where they'd like to use PA for either performance or safety reasons, please comment in the document. Thanks!----Kentaro Hara, Tokyo, Japan
You received this message because you are subscribed to the Google Groups "Project TRIM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-trim+unsubscribe@chromium.org.
To post to this group, send email to projec...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/project-trim/CABg10jwUqSE7eAfe0-7-F5%3DYFrZ2cczuGwXKFuqtD4VHDezGoQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/project-trim/CABg10jwnbKjzwqpgOcKDWJyZrzARZjveSTML1NsCC1Zfddiy7w%40mail.gmail.com.
Here's the question for the security experts: are there other properties other than suicide-on-OOM and int32 wrapping (no >4GB allocations) that make the current tcmalloc secure?In other words, if we get to a state where things are either PA-allocted or glibc-alloced + the two aforementioned checks above would that be a security regression? Or are the remaining tcmalloc benefit purely related to performance?
Since PartitionAlloc has different buckets for different object types my assumption is that it is less memory efficient. The memory released by deleting a CFoo object can't be used for allocating a CBar object even if the sizes match. Is this assumption correct?
I'm a bit behind. Would you summarize why you prefer glibc-malloc than tcmalloc? (I agree with your conclusion but want to correctly understand why the shim layer prefers glibc-malloc.)
Since PartitionAlloc has different buckets for different object types my assumption is that it is less memory efficient. The memory released by deleting a CFoo object can't be used for allocating a CBar object even if the sizes match. Is this assumption correct?
To unsubscribe from this group and stop receiving emails from it, send an email to project-trim...@chromium.org.
To post to this group, send email to projec...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/project-trim/CABg10jwUqSE7eAfe0-7-F5%3DYFrZ2cczuGwXKFuqtD4VHDezGoQ%40mail.gmail.com.
--Kentaro Hara, Tokyo, Japan
--
You received this message because you are subscribed to the Google Groups "Project TRIM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-trim...@chromium.org.
To post to this group, send email to projec...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/project-trim/CABg10jwnbKjzwqpgOcKDWJyZrzARZjveSTML1NsCC1Zfddiy7w%40mail.gmail.com.
> On Fri, Nov 4, 2016 at 5:49 PM Bruce Dawson <bruce...@chromium.org> wrote:
> Since PartitionAlloc has different buckets for different object types my assumption is that it is less memory efficient. The memory released by deleting a
> CFoo object can't be used for allocating a CBar object even if the sizes match. Is this assumption correct?
Correct. On the other side, though, there is another aspect about tc-malloc: It makes quite extensive uses of thread caches, which tend to be a non-negligible cost in a process which has 30+ threads.
The problem of tcmalloc is that once you free something that was hosted in a thread-local cache that memory won't be usable to serve an allocation from a different thread. So it really heavily depends on the allocation pattern.
I am not saying I expect PA to be better. But I am not saying I necessarily expect to be worse than tcmalloc. However your becomes more an argument for platforms like Android, where we use the default allocator from the system, which has been quite tuned over the years to be memory efficient.
To unsubscribe from this group and stop receiving emails from it, send an email to project-trim+unsubscribe@chromium.org.
To post to this group, send email to projec...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/project-trim/CABg10jwUqSE7eAfe0-7-F5%3DYFrZ2cczuGwXKFuqtD4VHDezGoQ%40mail.gmail.com.
----Kentaro Hara, Tokyo, Japan
You received this message because you are subscribed to the Google Groups "Project TRIM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-trim+unsubscribe@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/project-trim/CABg10jwnbKjzwqpgOcKDWJyZrzARZjveSTML1NsCC1Zfddiy7w%40mail.gmail.com.
Overall, I think that:- Move PA to base/- Use PA for more things in browser and renderer- Deprecate tcmallocis a great direction.
To unsubscribe from this group and stop receiving emails from it, send an email to project-trim...@chromium.org.
To post to this group, send email to projec...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/project-trim/CABg10jwUqSE7eAfe0-7-F5%3DYFrZ2cczuGwXKFuqtD4VHDezGoQ%40mail.gmail.com.
----Kentaro Hara, Tokyo, Japan
You received this message because you are subscribed to the Google Groups "Project TRIM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-trim...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/project-trim/CABg10jwnbKjzwqpgOcKDWJyZrzARZjveSTML1NsCC1Zfddiy7w%40mail.gmail.com.
--Kentaro Hara, Tokyo, Japan
--Kentaro Hara, Tokyo, Japan
--
You received this message because you are subscribed to the Google Groups "Project TRIM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-trim...@chromium.org.
To post to this group, send email to projec...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/project-trim/CABg10jxeT9TeNi_NX600eouZBbaB2fYJny9TBP2ky8woEZn%2Bpg%40mail.gmail.com.
Chris. Thanks for the super thorough summary, I was partly aware of some of the PA security benefits. My question was about TCMalloc though :)
Let me reword the question: say that 3 months from now we are in the state where 60% or more of the browser process has been switched to PA. What should we do with the remaining 40% on Linux?A) do we feel we have to keep tcmalloc as well because it gives additional security properties compared to glibc (does tcmalloc have any of these features you mentioned about PA?)
B) do we feel keeping the default allocator + the aforementioned trivial checks is safe enough?Essentially I am *not* questioning whether there is a security benefit in the switch to PA. I am questioning whether is there a security benefit in the current tcmalloc and whether we should preserve it for the non-PA cases that will be left around.
--
You received this message because you are subscribed to the Google Groups "Project TRIM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-trim...@chromium.org.
To post to this group, send email to projec...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/project-trim/CAOuvq23ViKs3wSC%2BevLKsGQrbzFnUCGNSZ-Ada_nUxtp%2BkOwNQ%40mail.gmail.com.