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

Issue 40233002: Avoid calling OS::TotalPhysicalMemory in defaults.cc, since this fails in the chrome renderer sandb… (Closed)

Created:
7 years, 2 months ago by rmcilroy
Modified:
7 years, 1 month ago
CC:
v8-dev, Paweł Hajdan Jr., Sven Panne, danno, Jakob Kummerow
Visibility:
Public.

Description

Avoid calling OS::TotalPhysicalMemory in defaults.cc, since this fails in the chrome renderer sandbox. Add an InitializeDefaultsForCurrentPlatform, which the embedder must call before requesting platform-default ResourceConstraints. BUG=None

Patch Set 1 #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+34 lines, -5 lines) Patch
M include/v8-defaults.h View 1 chunk +10 lines, -0 lines 3 comments Download
M src/d8.cc View 1 chunk +2 lines, -1 line 1 comment Download
M src/defaults.cc View 3 chunks +22 lines, -4 lines 1 comment Download

Messages

Total messages: 8 (0 generated)
rmcilroy
Benedikt: please review this CL.
7 years, 2 months ago (2013-10-24 13:53:18 UTC) #1
Benedikt Meurer
https://codereview.chromium.org/40233002/diff/1/include/v8-defaults.h File include/v8-defaults.h (right): https://codereview.chromium.org/40233002/diff/1/include/v8-defaults.h#newcode45 include/v8-defaults.h:45: uint64_t total_physical_memory); There was probably some misunderstanding on our ...
7 years, 2 months ago (2013-10-24 18:09:02 UTC) #2
rmcilroy
https://codereview.chromium.org/40233002/diff/1/include/v8-defaults.h File include/v8-defaults.h (right): https://codereview.chromium.org/40233002/diff/1/include/v8-defaults.h#newcode45 include/v8-defaults.h:45: uint64_t total_physical_memory); On 2013/10/24 18:09:02, Benedikt Meurer wrote: > ...
7 years, 2 months ago (2013-10-24 21:06:56 UTC) #3
Benedikt Meurer
On 2013/10/24 21:06:56, rmcilroy wrote: > https://codereview.chromium.org/40233002/diff/1/include/v8-defaults.h > File include/v8-defaults.h (right): > > https://codereview.chromium.org/40233002/diff/1/include/v8-defaults.h#newcode45 > ...
7 years, 2 months ago (2013-10-25 05:47:19 UTC) #4
rmcilroy
On 2013/10/25 05:47:19, Benedikt Meurer wrote: > On 2013/10/24 21:06:56, rmcilroy wrote: > > https://codereview.chromium.org/40233002/diff/1/include/v8-defaults.h ...
7 years, 2 months ago (2013-10-25 06:05:06 UTC) #5
Benedikt Meurer
On 2013/10/25 06:05:06, rmcilroy wrote: > On 2013/10/25 05:47:19, Benedikt Meurer wrote: > > On ...
7 years, 2 months ago (2013-10-25 06:12:48 UTC) #6
Sven Panne
NOT LGTM. We won't accept extremely ugly hacks in v8 to solve problems which are ...
7 years, 2 months ago (2013-10-25 06:27:16 UTC) #7
danno
7 years, 2 months ago (2013-10-25 07:26:14 UTC) #8
https://codereview.chromium.org/40233002/diff/1/include/v8-defaults.h
File include/v8-defaults.h (right):

https://codereview.chromium.org/40233002/diff/1/include/v8-defaults.h#newcode45
include/v8-defaults.h:45: uint64_t total_physical_memory);
On 2013/10/24 21:06:56, rmcilroy wrote:
> On 2013/10/24 18:09:02, Benedikt Meurer wrote:
> > There was probably some misunderstanding on our side. I thought we settled
on
> > the idea of explicitly initializing a ResourceConstraints object as
discussed
> > with danno. We don't want to have any more global state in V8.
> > 
> > Can you just add the explicit total_physical_memory parameter to
> > ConfigureResourceConstraintsForCurrentPlatform() below, drop the
> > SetDefaultResourceConstraintsForCurrentPlatform() method and do the
following
> in
> > d8.cc (and similar in Blink)?
> > 
> > ResourceConstraints constraints;
> > if (!ConfigureResourceConstraintsForCurrentPlatform(&constraints,
> > OS::TotalPhysicalMemory())) { Fatal... }
> > SetResourceConstraints(isolate, &constraints);
> 
> No, this is what I discussed with Daniel over VC and suggested in my email.
> Unfortunately we can't pass the total physical memory as a parameter in
> ConfigureResourceConstraintsForPlatform() due to the reasons I outlined in the
> email thread, namely that Blink can't get the total physical memory due to the
> sandbox (same problem as V8), and there is no clean way to plumb through a
> resource constraint object from Chrome to the isolate creation points in Blink
> (especially for workers where the thread initialisation doesn't enter Chrome
> code).

I apologize, this misunderstanding appears to be my fault. I misinterpreted your
proposal, I thought we were just discussing where
ConfigureResourceConstraintsForPlatform needs to be called and not passing
around the ResourceConstraint struct through Blink in our VC. I thought you were
proposing adding the size to the existing
ConfigureResourceConstraintsForCurrentPlatform call, not creating a new one.
Sorry, may bad.

I do see a fundamental difference between passing around the total memory size
and the ResourceConstraints struct in Chrome/Blink. The former seems like
something that is useful in other contexts, and therefore I'm sure that it's
possible to get the support to thread this through, while the second is
V8-specific. So, I think "right" thing to do is indeed pass the total physical
memory to ConfigureResourceConstraintsForPlatform(), and call that in the
sandbox immediately before SetResourceConstraints.

If you need help threading this through and somebody to help shepherd you CL,
I'd recommend getting in touch with Jochen Eisinger. He's in MUC and has the
clout to help get a change like this through.

Powered by Google App Engine
This is Rietveld 408576698