Instead of reserving 32MB of virtual memory let's reserve the quarter of
RLIMIT_DATA (ulimit -d) if RLIMIT_DATA is not 0 (unlimited). If RLIMIT_DATA is 0 then the default 512MB reservation will be used. Using 32MB made v8 use less memory for sure but it was a huge performance loss too.
This commit is contained in:
parent
b4d94612de
commit
c480666f7d
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.51 2011/05/31 07:55:04 robert Exp $
|
||||
# $OpenBSD: Makefile,v 1.52 2011/06/02 07:22:12 robert Exp $
|
||||
|
||||
ONLY_FOR_ARCHS= i386 amd64
|
||||
|
||||
@ -7,7 +7,7 @@ COMMENT= Chromium browser
|
||||
V= 11.0.696.71
|
||||
DISTNAME= chromium-${V}
|
||||
|
||||
REVISION= 1
|
||||
REVISION= 2
|
||||
|
||||
CATEGORIES= www
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
$OpenBSD: patch-base_base_paths_linux_cc,v 1.3 2011/03/15 11:38:05 robert Exp $
|
||||
--- base/base_paths_linux.cc.orig Fri Mar 11 10:01:33 2011
|
||||
+++ base/base_paths_linux.cc Mon Mar 14 18:01:28 2011
|
||||
$OpenBSD: patch-base_base_paths_linux_cc,v 1.4 2011/06/02 07:22:12 robert Exp $
|
||||
--- base/base_paths_linux.cc.orig Fri May 20 10:35:20 2011
|
||||
+++ base/base_paths_linux.cc Wed Jun 1 12:26:56 2011
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "base/base_paths.h"
|
||||
|
||||
@ -17,7 +17,7 @@ $OpenBSD: patch-base_base_paths_linux_cc,v 1.3 2011/03/15 11:38:05 robert Exp $
|
||||
+ return true;
|
||||
+#elif defined(OS_OPENBSD)
|
||||
+ *result = FilePath("/usr/local/chrome/chrome");
|
||||
+ //*result = FilePath("/home/pobj/chromium-10.0.648.133/chromium-10.0.648.133/out/Release/chrome");
|
||||
+ //*result = FilePath("/home/pobj/chromium-11.0.696.71/chromium-11.0.696.71/out/Release/chrome");
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
@ -1,12 +1,33 @@
|
||||
$OpenBSD: patch-v8_src_heap_cc,v 1.2 2011/05/31 07:55:04 robert Exp $
|
||||
$OpenBSD: patch-v8_src_heap_cc,v 1.3 2011/06/02 07:22:12 robert Exp $
|
||||
--- v8/src/heap.cc.orig Fri May 20 10:56:51 2011
|
||||
+++ v8/src/heap.cc Mon May 30 23:09:01 2011
|
||||
@@ -91,7 +91,7 @@ intptr_t Heap::max_executable_size_ = max_old_generati
|
||||
static const int default_max_semispace_size_ = 16*MB;
|
||||
intptr_t Heap::max_old_generation_size_ = 1*GB;
|
||||
int Heap::initial_semispace_size_ = 1*MB;
|
||||
-intptr_t Heap::code_range_size_ = 512*MB;
|
||||
+intptr_t Heap::code_range_size_ = 32*MB;
|
||||
intptr_t Heap::max_executable_size_ = 256*MB;
|
||||
#else
|
||||
static const int default_max_semispace_size_ = 8*MB;
|
||||
+++ v8/src/heap.cc Wed Jun 1 13:43:18 2011
|
||||
@@ -4503,6 +4503,29 @@ bool Heap::ConfigureHeap(int max_semispace_size,
|
||||
initial_semispace_size_ = Min(initial_semispace_size_, max_semispace_size_);
|
||||
external_allocation_limit_ = 10 * max_semispace_size_;
|
||||
|
||||
+ intptr_t max_virtual = OS::MaxVirtualMemory();
|
||||
+
|
||||
+ if (max_virtual > 0) {
|
||||
+ intptr_t half = max_virtual >> 1;
|
||||
+ intptr_t quarter = max_virtual >> 2;
|
||||
+ // If we have limits on the amount of virtual memory we can use then we may
|
||||
+ // be forced to lower the allocation limits. We reserve one quarter of the
|
||||
+ // memory for young space and off-heap data. The rest is distributed as
|
||||
+ // described below.
|
||||
+ if (code_range_size_ > 0) {
|
||||
+ // Reserve a quarter of the memory for the code range. The old space
|
||||
+ // heap gets the remaining half. There is some unavoidable double
|
||||
+ // counting going on here since the heap size is measured in committed
|
||||
+ // virtual memory and the code range is only reserved virtual memory.
|
||||
+ code_range_size_ = Min(code_range_size_, quarter);
|
||||
+ max_old_generation_size_ = Min(max_old_generation_size_, half);
|
||||
+ } else {
|
||||
+ // Reserve three quarters of the memory for the old space heap including
|
||||
+ // the executable code.
|
||||
+ max_old_generation_size_ = Min(max_old_generation_size_, half + quarter);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
// The old generation is paged.
|
||||
max_old_generation_size_ = RoundUp(max_old_generation_size_, Page::kPageSize);
|
||||
|
||||
|
22
www/chromium/patches/patch-v8_src_platform-posix_cc
Normal file
22
www/chromium/patches/patch-v8_src_platform-posix_cc
Normal file
@ -0,0 +1,22 @@
|
||||
$OpenBSD: patch-v8_src_platform-posix_cc,v 1.1 2011/06/02 07:22:12 robert Exp $
|
||||
--- v8/src/platform-posix.cc.orig Fri May 20 10:56:51 2011
|
||||
+++ v8/src/platform-posix.cc Wed Jun 1 13:43:18 2011
|
||||
@@ -54,6 +54,18 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
+
|
||||
+// Maximum size of the virtual memory. 0 means there is no artificial
|
||||
+// limit.
|
||||
+
|
||||
+intptr_t OS::MaxVirtualMemory() {
|
||||
+ struct rlimit limit;
|
||||
+ int result = getrlimit(RLIMIT_DATA, &limit);
|
||||
+ if (result != 0) return 0;
|
||||
+ return limit.rlim_cur;
|
||||
+}
|
||||
+
|
||||
+
|
||||
// ----------------------------------------------------------------------------
|
||||
// Math functions
|
||||
|
14
www/chromium/patches/patch-v8_src_platform_h
Normal file
14
www/chromium/patches/patch-v8_src_platform_h
Normal file
@ -0,0 +1,14 @@
|
||||
$OpenBSD: patch-v8_src_platform_h,v 1.1 2011/06/02 07:22:12 robert Exp $
|
||||
--- v8/src/platform.h.orig Fri May 20 10:56:51 2011
|
||||
+++ v8/src/platform.h Wed Jun 1 13:43:18 2011
|
||||
@@ -287,6 +287,10 @@ class OS {
|
||||
// positions indicated by the members of the CpuFeature enum from globals.h
|
||||
static uint64_t CpuFeaturesImpliedByPlatform();
|
||||
|
||||
+ // Maximum size of the virtual memory. 0 means there is no artificial
|
||||
+ // limit.
|
||||
+ static intptr_t MaxVirtualMemory();
|
||||
+
|
||||
// Returns the double constant NAN
|
||||
static double nan_value();
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.14 2011/05/31 07:55:16 robert Exp $
|
||||
# $OpenBSD: Makefile,v 1.15 2011/06/02 07:21:14 robert Exp $
|
||||
|
||||
# XXX:
|
||||
# - Needs __ARM_NR_cacheflush (or the like) to work on arm-based ports.
|
||||
@ -11,7 +11,7 @@ COMMENT= V8 JavaScript for clients and servers
|
||||
DISTNAME= node-v0.4.8
|
||||
PKGNAME= ${DISTNAME:S/v//g}
|
||||
|
||||
REVISION= 0
|
||||
REVISION= 1
|
||||
|
||||
CATEGORIES= www devel
|
||||
|
||||
|
@ -1,16 +1,33 @@
|
||||
$OpenBSD: patch-deps_v8_src_heap_cc,v 1.2 2011/05/31 07:55:16 robert Exp $
|
||||
|
||||
Don't allocate a huge chunk of VM upfront on amd64, but still use a bigger
|
||||
code range size to avoid crashing with vmmap.
|
||||
|
||||
$OpenBSD: patch-deps_v8_src_heap_cc,v 1.3 2011/06/02 07:21:14 robert Exp $
|
||||
--- deps/v8/src/heap.cc.orig Sat May 21 04:40:06 2011
|
||||
+++ deps/v8/src/heap.cc Mon May 30 22:57:26 2011
|
||||
@@ -91,7 +91,7 @@ intptr_t Heap::max_executable_size_ = max_old_generati
|
||||
static const int default_max_semispace_size_ = 16*MB;
|
||||
intptr_t Heap::max_old_generation_size_ = 1*GB;
|
||||
int Heap::initial_semispace_size_ = 1*MB;
|
||||
-intptr_t Heap::code_range_size_ = 512*MB;
|
||||
+intptr_t Heap::code_range_size_ = 32*MB;
|
||||
intptr_t Heap::max_executable_size_ = 256*MB;
|
||||
#else
|
||||
static const int default_max_semispace_size_ = 8*MB;
|
||||
+++ deps/v8/src/heap.cc Wed Jun 1 14:26:51 2011
|
||||
@@ -4503,6 +4503,29 @@ bool Heap::ConfigureHeap(int max_semispace_size,
|
||||
initial_semispace_size_ = Min(initial_semispace_size_, max_semispace_size_);
|
||||
external_allocation_limit_ = 10 * max_semispace_size_;
|
||||
|
||||
+ intptr_t max_virtual = OS::MaxVirtualMemory();
|
||||
+
|
||||
+ if (max_virtual > 0) {
|
||||
+ intptr_t half = max_virtual >> 1;
|
||||
+ intptr_t quarter = max_virtual >> 2;
|
||||
+ // If we have limits on the amount of virtual memory we can use then we may
|
||||
+ // be forced to lower the allocation limits. We reserve one quarter of the
|
||||
+ // memory for young space and off-heap data. The rest is distributed as
|
||||
+ // described below.
|
||||
+ if (code_range_size_ > 0) {
|
||||
+ // Reserve a quarter of the memory for the code range. The old space
|
||||
+ // heap gets the remaining half. There is some unavoidable double
|
||||
+ // counting going on here since the heap size is measured in committed
|
||||
+ // virtual memory and the code range is only reserved virtual memory.
|
||||
+ code_range_size_ = Min(code_range_size_, quarter);
|
||||
+ max_old_generation_size_ = Min(max_old_generation_size_, half);
|
||||
+ } else {
|
||||
+ // Reserve three quarters of the memory for the old space heap including
|
||||
+ // the executable code.
|
||||
+ max_old_generation_size_ = Min(max_old_generation_size_, half + quarter);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
// The old generation is paged.
|
||||
max_old_generation_size_ = RoundUp(max_old_generation_size_, Page::kPageSize);
|
||||
|
||||
|
22
www/node/patches/patch-deps_v8_src_platform-posix_cc
Normal file
22
www/node/patches/patch-deps_v8_src_platform-posix_cc
Normal file
@ -0,0 +1,22 @@
|
||||
$OpenBSD: patch-deps_v8_src_platform-posix_cc,v 1.1 2011/06/02 07:21:14 robert Exp $
|
||||
--- deps/v8/src/platform-posix.cc.orig Sat May 21 04:40:06 2011
|
||||
+++ deps/v8/src/platform-posix.cc Wed Jun 1 14:26:51 2011
|
||||
@@ -54,6 +54,18 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
+
|
||||
+// Maximum size of the virtual memory. 0 means there is no artificial
|
||||
+// limit.
|
||||
+
|
||||
+intptr_t OS::MaxVirtualMemory() {
|
||||
+ struct rlimit limit;
|
||||
+ int result = getrlimit(RLIMIT_DATA, &limit);
|
||||
+ if (result != 0) return 0;
|
||||
+ return limit.rlim_cur;
|
||||
+}
|
||||
+
|
||||
+
|
||||
// ----------------------------------------------------------------------------
|
||||
// Math functions
|
||||
|
14
www/node/patches/patch-deps_v8_src_platform_h
Normal file
14
www/node/patches/patch-deps_v8_src_platform_h
Normal file
@ -0,0 +1,14 @@
|
||||
$OpenBSD: patch-deps_v8_src_platform_h,v 1.1 2011/06/02 07:21:14 robert Exp $
|
||||
--- deps/v8/src/platform.h.orig Sat May 21 04:40:06 2011
|
||||
+++ deps/v8/src/platform.h Wed Jun 1 14:26:51 2011
|
||||
@@ -287,6 +287,10 @@ class OS {
|
||||
// positions indicated by the members of the CpuFeature enum from globals.h
|
||||
static uint64_t CpuFeaturesImpliedByPlatform();
|
||||
|
||||
+ // Maximum size of the virtual memory. 0 means there is no artificial
|
||||
+ // limit.
|
||||
+ static intptr_t MaxVirtualMemory();
|
||||
+
|
||||
// Returns the double constant NAN
|
||||
static double nan_value();
|
||||
|
Loading…
Reference in New Issue
Block a user