Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Issue 657113006: Add retry logic to partition alloc (Closed)

Created:
6 years, 2 months ago by jochen (gone - plz use gerrit)
Modified:
5 years, 4 months ago
CC:
aandrey+blink_chromium.org, blink-reviews, blink-reviews-wtf_chromium.org, Mikhail, mkwst+moarreviews_chromium.org, Tom Sepez
Project:
blink
Visibility:
Public.

Description

Add retry logic to partition alloc If an allocation fails, we'll trigger an emergency GC and retry once. We'll only try to free up memory on one thread - this means that if multiple threads run out of memory at the same time, we're still out of luck, but it's better than nothing. BUG=397037 R=cevans@chromium.org

Patch Set 1 #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+49 lines, -0 lines) Patch
M Source/web/WebKit.cpp View 3 chunks +11 lines, -0 lines 0 comments Download
M Source/wtf/PartitionAlloc.h View 3 chunks +7 lines, -0 lines 1 comment Download
M Source/wtf/PartitionAlloc.cpp View 4 chunks +31 lines, -0 lines 5 comments Download

Messages

Total messages: 15 (1 generated)
jochen (gone - plz use gerrit)
6 years, 2 months ago (2014-10-22 11:13:52 UTC) #1
jochen (gone - plz use gerrit)
+jl/tsepez fyi
6 years, 2 months ago (2014-10-22 11:15:58 UTC) #2
Jens Widell
https://codereview.chromium.org/657113006/diff/1/Source/wtf/PartitionAlloc.cpp File Source/wtf/PartitionAlloc.cpp (right): https://codereview.chromium.org/657113006/diff/1/Source/wtf/PartitionAlloc.cpp#newcode723 Source/wtf/PartitionAlloc.cpp:723: void* ptr = partitionAllocSlowPath(root, flags | PartitionAllocRetry, size, bucket); ...
6 years, 2 months ago (2014-10-22 11:24:05 UTC) #4
Jens Widell
On 2014/10/22 11:24:05, Jens Widell wrote: > https://codereview.chromium.org/657113006/diff/1/Source/wtf/PartitionAlloc.cpp > File Source/wtf/PartitionAlloc.cpp (right): > > https://codereview.chromium.org/657113006/diff/1/Source/wtf/PartitionAlloc.cpp#newcode723 ...
6 years, 2 months ago (2014-10-22 11:33:04 UTC) #5
jochen (gone - plz use gerrit)
I wonder what will happen when the GC frees up memory but also causes some ...
6 years, 2 months ago (2014-10-22 11:38:45 UTC) #6
Jens Widell
On 2014/10/22 11:38:45, jochen wrote: > I wonder what will happen when the GC frees ...
6 years, 2 months ago (2014-10-22 11:51:52 UTC) #7
jochen (gone - plz use gerrit)
hum, I wonder whether partitionAllocBucket should do the retrying. or maybe the retry in partitionAllocSlowPath ...
6 years, 2 months ago (2014-10-22 15:22:45 UTC) #8
Jens Widell
On 2014/10/22 15:22:45, jochen wrote: > hum, I wonder whether partitionAllocBucket should do the retrying. ...
6 years, 2 months ago (2014-10-22 15:31:40 UTC) #9
jochen (gone - plz use gerrit)
On 2014/10/22 at 15:31:40, jl wrote: > On 2014/10/22 15:22:45, jochen wrote: > > hum, ...
6 years, 2 months ago (2014-10-22 15:33:43 UTC) #10
Jens Widell
On 2014/10/22 15:33:43, jochen wrote: > so what I don't understand is this. If we ...
6 years, 2 months ago (2014-10-22 15:41:37 UTC) #11
Jens Widell
On 2014/10/22 15:41:37, Jens Widell wrote: > On 2014/10/22 15:33:43, jochen wrote: > > are ...
6 years, 2 months ago (2014-10-22 16:19:30 UTC) #12
Chris Evans
Generally, looking nice and simple. I agree with Jens' comment that we can use partitionBucketAlloc() ...
6 years, 1 month ago (2014-11-06 21:43:51 UTC) #13
Chris Evans
https://codereview.chromium.org/657113006/diff/1/Source/wtf/PartitionAlloc.cpp File Source/wtf/PartitionAlloc.cpp (right): https://codereview.chromium.org/657113006/diff/1/Source/wtf/PartitionAlloc.cpp#newcode320 Source/wtf/PartitionAlloc.cpp:320: { One more thing. Can we add here a ...
6 years, 1 month ago (2014-11-06 21:45:34 UTC) #14
Chris Evans
6 years, 1 month ago (2014-11-06 22:01:21 UTC) #15
On 2014/11/06 21:45:34, Chris Evans wrote:
> https://codereview.chromium.org/657113006/diff/1/Source/wtf/PartitionAlloc.cpp
> File Source/wtf/PartitionAlloc.cpp (right):
> 
>
https://codereview.chromium.org/657113006/diff/1/Source/wtf/PartitionAlloc.cp...
> Source/wtf/PartitionAlloc.cpp:320: {
> One more thing. Can we add here a // TODO comment that says we should also
take
> the opportunity to flush the ring list of unused but still committed pages?

Hmm, the more I think about this, the more nervous I'm becoming.

What if we were using standard system malloc() for all allocations? We would
simply have to put up with a NULL result being returned to the caller, or a
std::bad_alloc for operator new.
There's a similar story with tcmalloc, where I don't think there's a callback +
retry facility? You'll just get a crash.

So I worry that we're adding re-entrancy-based complexity just because we can in
this case, because it's easy to modify an in-Blink-tree allocator.

I also worry that adding this complexity won't solve the problem fully. If the
system is low on memory, there's every chance that a tcmalloc-backed allocation
will be the one that pushes things over the edge, e.g. perhaps from an image
decode or IPC message deserialize etc.

Powered by Google App Engine
This is Rietveld 408576698