<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>175150</bug_id>
          
          <creation_ts>2017-08-03 13:00:55 -0700</creation_ts>
          <short_desc>[Linux] Clear WasmMemory with madvice instead of memset</short_desc>
          <delta_ts>2017-08-08 06:11:05 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>Safari Technology Preview</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=175140</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=170343</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Carlos Alberto Lopez Perez">clopez</reporter>
          <assigned_to name="Carlos Alberto Lopez Perez">clopez</assigned_to>
          <cc>bugs-noreply</cc>
    
    <cc>buildbot</cc>
    
    <cc>fpizlo</cc>
    
    <cc>ggaren</cc>
    
    <cc>keith_miller</cc>
    
    <cc>mark.lam</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>msaboff</cc>
    
    <cc>saam</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>ysuzuki</cc>
    
    <cc>zan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1334899</commentid>
    <comment_count>0</comment_count>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2017-08-03 13:00:55 -0700</bug_when>
    <thetext>The test wasm/js-api/test_memory_constructor.js requires lot of RAM to run.

On Linux/WebKitGTK+ it currently peaks around 8GB of RSS and spawns 6 subtests at the same time, therefore it requires ~48 GB of RAM to run without trouble.

On Mac it peaks around 2.5GB of RSS and also spawns 6 subtests (So I guess it will run fine there with 16GB of RAM).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1334901</commentid>
    <comment_count>1</comment_count>
      <attachid>317140</attachid>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2017-08-03 13:04:23 -0700</bug_when>
    <thetext>Created attachment 317140
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335194</commentid>
    <comment_count>2</comment_count>
      <attachid>317140</attachid>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2017-08-04 02:52:55 -0700</bug_when>
    <thetext>Comment on attachment 317140
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=317140&amp;action=review

&gt; JSTests/wasm/js-api/test_memory_constructor.js:5
&gt;  // FIXME: use the assert library: https://bugs.webkit.org/show_bug.cgi?id=165684
&gt; +//@ skip if $memoryLimited
&gt;  import Builder from &apos;../Builder.js&apos;;
&gt;  
&gt;  function assert(b) {

I know this kind of patches (actually gardening related) don&apos;t need review.
But I wanted some feedback/review in this specific case.

This test is causing OOM related problems on the Linux bots (We are now running the JSC tests with --memory limited after https://bugs.webkit.org/show_bug.cgi?id=175140 ).
So, I want to land this ASAP and I will land this patch now unreviewed.

Feedback is still welcome (and of course we are always on time to rework or revert the patch if some of you don&apos;t think this change is right)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335199</commentid>
    <comment_count>3</comment_count>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2017-08-04 03:01:26 -0700</bug_when>
    <thetext>Committed r220265: &lt;http://trac.webkit.org/changeset/220265&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335201</commentid>
    <comment_count>4</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2017-08-04 03:02:16 -0700</bug_when>
    <thetext>&lt;rdar://problem/33720817&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335365</commentid>
    <comment_count>5</comment_count>
      <attachid>317140</attachid>
    <who name="Saam Barati">saam</who>
    <bug_when>2017-08-04 11:42:35 -0700</bug_when>
    <thetext>Comment on attachment 317140
Patch

Carlos, is the fast memory optimization enabled on Linux? If so, we’ll allocate about 4GB for a WebAssembly memory if we can. A good place to start is o see if we enable this on Linux. If so, that’s eating up a lot of virtual memory.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335366</commentid>
    <comment_count>6</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-08-04 11:46:18 -0700</bug_when>
    <thetext>(In reply to Saam Barati from comment #5)
&gt; Comment on attachment 317140 [details]
&gt; Patch
&gt; 
&gt; Carlos, is the fast memory optimization enabled on Linux? If so, we’ll
&gt; allocate about 4GB for a WebAssembly memory if we can. A good place to start
&gt; is o see if we enable this on Linux. If so, that’s eating up a lot of
&gt; virtual memory.

Yes, it is enabled in Linux ports.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335426</commentid>
    <comment_count>7</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2017-08-04 13:40:14 -0700</bug_when>
    <thetext>(In reply to Yusuke Suzuki from comment #6)
&gt; (In reply to Saam Barati from comment #5)
&gt; &gt; Comment on attachment 317140 [details]
&gt; &gt; Patch
&gt; &gt; 
&gt; &gt; Carlos, is the fast memory optimization enabled on Linux? If so, we’ll
&gt; &gt; allocate about 4GB for a WebAssembly memory if we can. A good place to start
&gt; &gt; is o see if we enable this on Linux. If so, that’s eating up a lot of
&gt; &gt; virtual memory.
&gt; 
&gt; Yes, it is enabled in Linux ports.

It seems likely this is why a lot of memory is being used. That said, it should be just virtual memory, and hopefully not need actual 48GB physical memory. Has this recently regressed? Or has it always been an issue? Maybe it&apos;s gigacage related since that code touched the Wasm memory allocation code path. Maybe we&apos;re missing a syscall letting the kernel know that it doesn&apos;t actually need to allocate physical memory for these pages.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335439</commentid>
    <comment_count>8</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-08-04 13:59:08 -0700</bug_when>
    <thetext>(In reply to Saam Barati from comment #7)
&gt; (In reply to Yusuke Suzuki from comment #6)
&gt; &gt; (In reply to Saam Barati from comment #5)
&gt; &gt; &gt; Comment on attachment 317140 [details]
&gt; &gt; &gt; Patch
&gt; &gt; &gt; 
&gt; &gt; &gt; Carlos, is the fast memory optimization enabled on Linux? If so, we’ll
&gt; &gt; &gt; allocate about 4GB for a WebAssembly memory if we can. A good place to start
&gt; &gt; &gt; is o see if we enable this on Linux. If so, that’s eating up a lot of
&gt; &gt; &gt; virtual memory.
&gt; &gt; 
&gt; &gt; Yes, it is enabled in Linux ports.
&gt; 
&gt; It seems likely this is why a lot of memory is being used. That said, it
&gt; should be just virtual memory, and hopefully not need actual 48GB physical
&gt; memory. Has this recently regressed? Or has it always been an issue? Maybe
&gt; it&apos;s gigacage related since that code touched the Wasm memory allocation
&gt; code path. Maybe we&apos;re missing a syscall letting the kernel know that it
&gt; doesn&apos;t actually need to allocate physical memory for these pages.

I&apos;ve just checked and I think it is regression.
Actually, RSS becomes 4GB~ in Linux jsc process. I&apos;m looking into this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335516</commentid>
    <comment_count>9</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-08-04 15:12:21 -0700</bug_when>
    <thetext>(In reply to Yusuke Suzuki from comment #8)
&gt; I&apos;ve just checked and I think it is regression.
&gt; Actually, RSS becomes 4GB~ in Linux jsc process. I&apos;m looking into this.

In WasmMemory, in fast memory case, we use memset to initialize memory.
Yeah, but of course, it populates backing store. Is it intentional?
I wonder if this also populates memory in Darwin.

https://github.com/WebKit/webkit/blob/master/Source/JavaScriptCore/wasm/WasmMemory.cpp#L305</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335535</commentid>
    <comment_count>10</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-08-04 15:29:38 -0700</bug_when>
    <thetext>(In reply to Yusuke Suzuki from comment #9)
&gt; (In reply to Yusuke Suzuki from comment #8)
&gt; &gt; I&apos;ve just checked and I think it is regression.
&gt; &gt; Actually, RSS becomes 4GB~ in Linux jsc process. I&apos;m looking into this.
&gt; 
&gt; In WasmMemory, in fast memory case, we use memset to initialize memory.
&gt; Yeah, but of course, it populates backing store. Is it intentional?
&gt; I wonder if this also populates memory in Darwin.
&gt; 
&gt; https://github.com/WebKit/webkit/blob/master/Source/JavaScriptCore/wasm/
&gt; WasmMemory.cpp#L305

I think

1. When freeing large memory with AllocationKind == virtual, we should set LargeRange with physicalSize = size because virtual memory could be populated anyway.
2. Do not call memset in WasmMemory. We should rely on bmalloc&apos;s large memory allocation. It is responsibility of bmalloc to zero-fill this virtual memory area without populating backing pages. In Linux case, we should call madvice(MADV_DONTNEED).

Fil, Saam and Geoff, what do you think of?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335707</commentid>
    <comment_count>11</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-08-05 10:52:47 -0700</bug_when>
    <thetext>Reopening to attach new patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335708</commentid>
    <comment_count>12</comment_count>
      <attachid>317342</attachid>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-08-05 10:52:49 -0700</bug_when>
    <thetext>Created attachment 317342
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335812</commentid>
    <comment_count>13</comment_count>
      <attachid>317375</attachid>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-08-06 12:09:59 -0700</bug_when>
    <thetext>Created attachment 317375
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335826</commentid>
    <comment_count>14</comment_count>
      <attachid>317375</attachid>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2017-08-06 12:56:46 -0700</bug_when>
    <thetext>Comment on attachment 317375
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=317375&amp;action=review

&gt; JSTests/wasm/js-api/test_memory_constructor.js:4
&gt;  // FIXME: use the assert library: https://bugs.webkit.org/show_bug.cgi?id=165684
&gt; -//@ skip if $memoryLimited
&gt;  import Builder from &apos;../Builder.js&apos;;
&gt;  
&gt;  function assert(b) {

When this test runs it spawns 6 jsc process (6 subtests). The difference between this 6 subtests is on the parameter passed:

By checking the ps output I see the base arguments for all 6 subtests are: &quot;--useFTLJIT=true --useFunctionDotArguments=true --maxPerThreadStackUsage=1572864 -m&quot;

And then, the difference on the arguments (from the base ones) for each one of this 6 subtests are:

Subtest 1: Pass no extra paremeter.
Subtest 2: Pass --forceCodeBlockToJettisonDueToOldAge=true
Subtest 3: Pass --useCallICsForWebAssemblyToJSCalls=false 
Subtest 4: Pass --useFastTLSForWasmContext=true --useConcurrentJIT=false --thresholdForJITAfterWarmUp=100 --scribbleFreeCells=true 
Subtest 5: Pass --useFastTLSForWasmContext=false 
Subtest 6: Pass --useWebAssemblyFastMemory=false 


Before this patch, all 6 subtests where allocating 8GB of RSS.

I have tested the patch and after it, 5 of the 6 subtests now allocate only a few MB of RSS (instead of 8GB).

So this is amazing! :)


But there is still one that keeps using 8GB of RAM of RSS (Resident Set Size).

And its the 6# one, the one that runs with --useWebAssemblyFastMemory=false 

You can check it manually by doing this:

# Terminal 1
$ while true; do if ps x -o pid,rss,vsz,command | grep js[c]|grep -v python|grep -v ruby; then  free -m; echo ; fi;done


# Terminal 2
$ cd WebKit
$ cd JSTests/wasm
$ ../../WebKitBuild/Release/bin/jsc --useFTLJIT=true --useFunctionDotArguments=true --maxPerThreadStackUsage=1572864 -m --useWebAssemblyFastMemory=false js-api/test_memory_constructor.js

You should see on the other terminal how the jsc process still peaks at 8GB of RSS for the JSC process.


If we can fix this also this 6th case, then we can remove the &quot;@ skip if $memoryLimited&quot; line.

But otherwise maybe is better to keep it, as running this test still requires 8GB of RAM (which I guess is more than what a memorylimited machine can use without issues)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335828</commentid>
    <comment_count>15</comment_count>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2017-08-06 13:16:52 -0700</bug_when>
    <thetext>(In reply to Yusuke Suzuki from comment #9)
&gt; (In reply to Yusuke Suzuki from comment #8)
&gt; &gt; I&apos;ve just checked and I think it is regression.
&gt; &gt; Actually, RSS becomes 4GB~ in Linux jsc process. I&apos;m looking into this.
&gt; 
&gt; In WasmMemory, in fast memory case, we use memset to initialize memory.
&gt; Yeah, but of course, it populates backing store. Is it intentional?
&gt; I wonder if this also populates memory in Darwin.
&gt; 
&gt; https://github.com/WebKit/webkit/blob/master/Source/JavaScriptCore/wasm/
&gt; WasmMemory.cpp#L305

I think this also populates memory on Darwin. Right? I will be really surprised if this is not the case.

When I tested this on a mac, I saw each one of the 6 subtests peaking at 2.5GB of RSS (on Mac). On Linux they peak at 8GB of RSS.


After the patch https://bugs.webkit.org/attachment.cgi?id=317375 5 of the 6 subtests (the ones that run with useWebAssemblyFastMemory=true) only use a few MBs of RSS (less than 20MB). But on Mac this 5 tests still allocate 2.5GB of RSS (I believe, I don&apos;t have a Mac at hand now, I may confirm this tomorrow)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335891</commentid>
    <comment_count>16</comment_count>
      <attachid>317404</attachid>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-08-06 23:46:57 -0700</bug_when>
    <thetext>Created attachment 317404
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335892</commentid>
    <comment_count>17</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-08-06 23:49:00 -0700</bug_when>
    <thetext>I keep memoryLimited annotation since this patch only solves the problem under fast memory.
I don&apos;t think using madvise to non fast memory thing is not good solution. So, I keep the current one as is. But it is not a problem since Linux ports always use fast memory right now. And fast memory will not be disabled if WebKitGTK+ does not support WebKitLegacy.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335925</commentid>
    <comment_count>18</comment_count>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2017-08-07 05:08:14 -0700</bug_when>
    <thetext>(In reply to Carlos Alberto Lopez Perez from comment #15)
&gt; (In reply to Yusuke Suzuki from comment #9)
&gt; &gt; (In reply to Yusuke Suzuki from comment #8)
&gt; &gt; &gt; I&apos;ve just checked and I think it is regression.
&gt; &gt; &gt; Actually, RSS becomes 4GB~ in Linux jsc process. I&apos;m looking into this.
&gt; &gt; 
&gt; &gt; In WasmMemory, in fast memory case, we use memset to initialize memory.
&gt; &gt; Yeah, but of course, it populates backing store. Is it intentional?
&gt; &gt; I wonder if this also populates memory in Darwin.
&gt; &gt; 
&gt; &gt; https://github.com/WebKit/webkit/blob/master/Source/JavaScriptCore/wasm/
&gt; &gt; WasmMemory.cpp#L305
&gt; 
&gt; I think this also populates memory on Darwin. Right? I will be really
&gt; surprised if this is not the case.
&gt; 
&gt; When I tested this on a mac, I saw each one of the 6 subtests peaking at
&gt; 2.5GB of RSS (on Mac). On Linux they peak at 8GB of RSS.
&gt; 
&gt; 
&gt; After the patch https://bugs.webkit.org/attachment.cgi?id=317375 5 of the 6
&gt; subtests (the ones that run with useWebAssemblyFastMemory=true) only use a
&gt; few MBs of RSS (less than 20MB). But on Mac this 5 tests still allocate
&gt; 2.5GB of RSS (I believe, I don&apos;t have a Mac at hand now, I may confirm this
&gt; tomorrow)

Confirmed. Running this test on Mac also requires lot of RAM. So I guess this means that memset(0) also causes allocation of real RAM on Darwin (seems logic).

Each one of this 6 subtests want to use 8GB of RSS also on Mac, but since the Mac that I have for tests &quot;only&quot; has 16GB of RAM and there are 6 subtests on parallel they only get to use 2.5GB (16/6) of RSS each one before the Darwin kernel does something with them (Killing them?). On the dmesg log this appears for all of them:

CODE SIGNING: cs_invalid_page(0x10daeb000): p=11709[jsc] final status 0x0, allowing (remove VALID) page

No idea what that means.


So: the same issue that happens on Linux seems to happen on Mac. But on Mac an OOM situation doesn&apos;t cause a bad user experience (desktop freezes) like on Linux.


I tested this by running:

1) Terminal 1
$ while true; d if ps x -o pid,rss,vsz,command | grep js[c]|grep -v python|grep -v ruby; then  top -l 1 -s 0 | grep PhysMem; echo ; fi;done


2) Terminal 2
$ Tools/Scripts/run-javascriptcore-tests --release --no-build --no-testapi --no-testmasm --no-testair --no-testb3  --no-mozilla-tests --no-quick  --filter js-api/test_memory_constructor.js


The attached patch here makes the situation much better on Linux, as all the 5 subtests that run with useWebAssemblyFastMemory=true now only need to allocate a few MBs (less than 20MB). On mac the patch makes no difference, is neutral there.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335926</commentid>
    <comment_count>19</comment_count>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2017-08-07 05:09:35 -0700</bug_when>
    <thetext>(In reply to Carlos Alberto Lopez Perez from comment #18)
&gt; I tested this by running:
&gt; 
&gt; 1) Terminal 1
&gt; $ while true; d if ps x -o pid,rss,vsz,command | grep js[c]|grep -v
&gt; python|grep -v ruby; then  top -l 1 -s 0 | grep PhysMem; echo ; fi;done
&gt; 

while true; do if ps x -o pid,rss,vsz,command | grep js[c]|grep -v python|grep -v ruby; then  top -l 1 -s 0 | grep PhysMem; echo ; fi; done</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335927</commentid>
    <comment_count>20</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-08-07 05:22:22 -0700</bug_when>
    <thetext>This patch intends to fix OOM issue in Linux. So, the change is guarded by OS(LINUX). In the different OSes, no change is made by this patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335928</commentid>
    <comment_count>21</comment_count>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2017-08-07 05:39:35 -0700</bug_when>
    <thetext>(In reply to Yusuke Suzuki from comment #20)
&gt; This patch intends to fix OOM issue in Linux. So, the change is guarded by
&gt; OS(LINUX). In the different OSes, no change is made by this patch.

Right.

The patch is a really good improvement and I&apos;ll r+ it tomorrow if no further comments by Saam or someone else.

But I was wondering why using memset(0) here for Mac? Is just because on Mac you can trigger an OOM condition without having to fear to bring down or freeze the system? That don&apos;t seems right to me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335929</commentid>
    <comment_count>22</comment_count>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2017-08-07 05:41:37 -0700</bug_when>
    <thetext>(In reply to Carlos Alberto Lopez Perez from comment #21)
&gt; But I was wondering why using memset(0) here for Mac? Is just because on Mac
&gt; you can trigger an OOM condition without having to fear to bring down or
&gt; freeze the system? That don&apos;t seems right to me.

To be clear: this question is not related with this patch, but more general wondering about why the current code is doing this.

Using memset(0) is what is currently happening before any patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335934</commentid>
    <comment_count>23</comment_count>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2017-08-07 06:04:09 -0700</bug_when>
    <thetext>(In reply to Carlos Alberto Lopez Perez from comment #22)
&gt; (In reply to Carlos Alberto Lopez Perez from comment #21)
&gt; &gt; But I was wondering why using memset(0) here for Mac? Is just because on Mac
&gt; &gt; you can trigger an OOM condition without having to fear to bring down or
&gt; &gt; freeze the system? That don&apos;t seems right to me.
&gt; 
&gt; To be clear: this question is not related with this patch, but more general
&gt; wondering about why the current code is doing this.
&gt; 
&gt; Using memset(0) is what is currently happening before any patch

A few git blames reveal this: https://trac.webkit.org/browser/trunk/Source/JavaScriptCore/wasm/WasmMemory.cpp?rev=219595#L69 which was then removed (the comment) on r220118 &lt;https://trac.webkit.org/r220118&gt;

So bug 170343 seems related.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335940</commentid>
    <comment_count>24</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2017-08-07 07:02:16 -0700</bug_when>
    <thetext>(In reply to Yusuke Suzuki from comment #17)
&gt; I keep memoryLimited annotation since this patch only solves the problem
&gt; under fast memory.
&gt; I don&apos;t think using madvise to non fast memory thing is not good solution.
&gt; So, I keep the current one as is. But it is not a problem since Linux ports
&gt; always use fast memory right now. And fast memory will not be disabled if
&gt; WebKitGTK+ does not support WebKitLegacy.

Not sure if I understand this correctly, but: we do support using system malloc, and we have distributors that depend on it because bmalloc does not work on certain architectures.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335944</commentid>
    <comment_count>25</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-08-07 07:10:05 -0700</bug_when>
    <thetext>(In reply to Michael Catanzaro from comment #24)
&gt; (In reply to Yusuke Suzuki from comment #17)
&gt; &gt; I keep memoryLimited annotation since this patch only solves the problem
&gt; &gt; under fast memory.
&gt; &gt; I don&apos;t think using madvise to non fast memory thing is not good solution.
&gt; &gt; So, I keep the current one as is. But it is not a problem since Linux ports
&gt; &gt; always use fast memory right now. And fast memory will not be disabled if
&gt; &gt; WebKitGTK+ does not support WebKitLegacy.
&gt; 
&gt; Not sure if I understand this correctly, but: we do support using system
&gt; malloc, and we have distributors that depend on it because bmalloc does not
&gt; work on certain architectures.

If we use system malloc, our Gigacage::tryAllocateVirtualPages just execute OSAllocator. And our commitZeroPages in this patch just works fine.
So, both is ok.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335947</commentid>
    <comment_count>26</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-08-07 07:42:46 -0700</bug_when>
    <thetext>(In reply to Carlos Alberto Lopez Perez from comment #22)
&gt; (In reply to Carlos Alberto Lopez Perez from comment #21)
&gt; &gt; But I was wondering why using memset(0) here for Mac? Is just because on Mac
&gt; &gt; you can trigger an OOM condition without having to fear to bring down or
&gt; &gt; freeze the system? That don&apos;t seems right to me.
&gt; 
&gt; To be clear: this question is not related with this patch, but more general
&gt; wondering about why the current code is doing this.
&gt; 
&gt; Using memset(0) is what is currently happening before any patch

As is described in bug 170343, changing the strategy based on required memory size would be promising.
But, as a first step, doing on-demand-paging in this patch and then deciding the threshold sounds better.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335951</commentid>
    <comment_count>27</comment_count>
      <attachid>317404</attachid>
    <who name="Saam Barati">saam</who>
    <bug_when>2017-08-07 08:14:07 -0700</bug_when>
    <thetext>Comment on attachment 317404
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=317404&amp;action=review

&gt; Source/JavaScriptCore/wasm/WasmMemory.cpp:263
&gt; +    while (madvise(startAddress, sizeInBytes, MADV_DONTNEED) == -1 &amp;&amp; errno == EAGAIN) { }

This feels wrong. The programmer is telling us they need this memory (most likely because they will run a wasm program and access it), but you’re telling the kernel you don’t expect this memory to be accessed anytime soon. This feels wrong, and it seems possible that it will slow down actual Wasm programs.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335957</commentid>
    <comment_count>28</comment_count>
      <attachid>317404</attachid>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-08-07 08:44:18 -0700</bug_when>
    <thetext>Comment on attachment 317404
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=317404&amp;action=review

&gt;&gt; Source/JavaScriptCore/wasm/WasmMemory.cpp:263
&gt;&gt; +    while (madvise(startAddress, sizeInBytes, MADV_DONTNEED) == -1 &amp;&amp; errno == EAGAIN) { }
&gt; 
&gt; This feels wrong. The programmer is telling us they need this memory (most likely because they will run a wasm program and access it), but you’re telling the kernel you don’t expect this memory to be accessed anytime soon. This feels wrong, and it seems possible that it will slow down actual Wasm programs.

That&apos;s why we immediately execute OSAllocator::commit after that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335959</commentid>
    <comment_count>29</comment_count>
      <attachid>317404</attachid>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-08-07 08:50:50 -0700</bug_when>
    <thetext>Comment on attachment 317404
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=317404&amp;action=review

&gt;&gt;&gt; Source/JavaScriptCore/wasm/WasmMemory.cpp:263
&gt;&gt;&gt; +    while (madvise(startAddress, sizeInBytes, MADV_DONTNEED) == -1 &amp;&amp; errno == EAGAIN) { }
&gt;&gt; 
&gt;&gt; This feels wrong. The programmer is telling us they need this memory (most likely because they will run a wasm program and access it), but you’re telling the kernel you don’t expect this memory to be accessed anytime soon. This feels wrong, and it seems possible that it will slow down actual Wasm programs.
&gt; 
&gt; That&apos;s why we immediately execute OSAllocator::commit after that.

For the case of the small size, memset(...) would be nice here.
I don&apos;t think memset all the area of this here, it exhausts memory even if it is not used.
The threshold should be decided based on the result of some benchmark.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335960</commentid>
    <comment_count>30</comment_count>
      <attachid>317404</attachid>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-08-07 08:52:37 -0700</bug_when>
    <thetext>Comment on attachment 317404
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=317404&amp;action=review

&gt;&gt;&gt;&gt; Source/JavaScriptCore/wasm/WasmMemory.cpp:263
&gt;&gt;&gt;&gt; +    while (madvise(startAddress, sizeInBytes, MADV_DONTNEED) == -1 &amp;&amp; errno == EAGAIN) { }
&gt;&gt;&gt; 
&gt;&gt;&gt; This feels wrong. The programmer is telling us they need this memory (most likely because they will run a wasm program and access it), but you’re telling the kernel you don’t expect this memory to be accessed anytime soon. This feels wrong, and it seems possible that it will slow down actual Wasm programs.
&gt;&gt; 
&gt;&gt; That&apos;s why we immediately execute OSAllocator::commit after that.
&gt; 
&gt; For the case of the small size, memset(...) would be nice here.
&gt; I don&apos;t think memset all the area of this here, it exhausts memory even if it is not used.
&gt; The threshold should be decided based on the result of some benchmark.

I mean, I don&apos;t think clearing all the area here by using memset is good way. I t exhausts memory even if it is not used. (And currently, it exhausts memory in Linux).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335987</commentid>
    <comment_count>31</comment_count>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2017-08-07 09:34:20 -0700</bug_when>
    <thetext>(In reply to Yusuke Suzuki from comment #30)
&gt; Comment on attachment 317404 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=317404&amp;action=review
&gt; 
&gt; &gt;&gt;&gt;&gt; Source/JavaScriptCore/wasm/WasmMemory.cpp:263
&gt; &gt;&gt;&gt;&gt; +    while (madvise(startAddress, sizeInBytes, MADV_DONTNEED) == -1 &amp;&amp; errno == EAGAIN) { }
&gt; &gt;&gt;&gt; 
&gt; &gt;&gt;&gt; This feels wrong. The programmer is telling us they need this memory (most likely because they will run a wasm program and access it), but you’re telling the kernel you don’t expect this memory to be accessed anytime soon. This feels wrong, and it seems possible that it will slow down actual Wasm programs.
&gt; &gt;&gt; 
&gt; &gt;&gt; That&apos;s why we immediately execute OSAllocator::commit after that.
&gt; &gt; 
&gt; &gt; For the case of the small size, memset(...) would be nice here.
&gt; &gt; I don&apos;t think memset all the area of this here, it exhausts memory even if it is not used.
&gt; &gt; The threshold should be decided based on the result of some benchmark.
&gt; 
&gt; I mean, I don&apos;t think clearing all the area here by using memset is good
&gt; way. I t exhausts memory even if it is not used. (And currently, it exhausts
&gt; memory in Linux).

It exhausts memory also on Mac.

Basically this test is asking for _two_ memory segments with an _initial_ size of 4GBs.

See https://trac.webkit.org/browser/trunk/JSTests/wasm/js-api/test_memory_constructor.js?rev=220265#L44
and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory

And 6 subtests are executed on parallel. So...., the only way this test can run fine is if your machine has 48GB of RAM.

On Mac it throws an error (therefore the messages I saw here https://bugs.webkit.org/show_bug.cgi?id=175150#c18 about dmesg).
On Linux it either does the same (throw) or gets killed by the Linux OOM killer.

On Mac causing an OOM condition seems more or less fine (you maybe even don&apos;t notice). On Linux is not fine. Your computer will freeze for several seconds.  A similar issue was discussed on bug 175100


Do we really need to try to allocate so much memory for this test? The Mac JSC bots &quot;only&quot; have 16GBs of RAM. I think this test is really throwing exceptions there because there is not enough memory to run the 6 subtests at the same time. And instead of testing what it was meant to test, its testing that it can throw an error (that is catched) for not enough memory.

However, I think this patch is a really interesting approach and can make things better when some application requests more initial memory than it will really needs. Ideally this should be done with some heuristics based on the requested size. If the size is small using memset(0) is probably better than calling MADV_DONTNEED. I&apos;m speculating here as I have no real idea, some benchmark or empiric testing will be needed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1336010</commentid>
    <comment_count>32</comment_count>
      <attachid>317404</attachid>
    <who name="Filip Pizlo">fpizlo</who>
    <bug_when>2017-08-07 10:18:33 -0700</bug_when>
    <thetext>Comment on attachment 317404
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=317404&amp;action=review

This patch seems sensible to me.  r=me.

&gt;&gt;&gt;&gt;&gt;&gt; Source/JavaScriptCore/wasm/WasmMemory.cpp:263
&gt;&gt;&gt;&gt;&gt;&gt; +    while (madvise(startAddress, sizeInBytes, MADV_DONTNEED) == -1 &amp;&amp; errno == EAGAIN) { }
&gt;&gt;&gt;&gt;&gt; 
&gt;&gt;&gt;&gt;&gt; This feels wrong. The programmer is telling us they need this memory (most likely because they will run a wasm program and access it), but you’re telling the kernel you don’t expect this memory to be accessed anytime soon. This feels wrong, and it seems possible that it will slow down actual Wasm programs.
&gt;&gt;&gt;&gt; 
&gt;&gt;&gt;&gt; That&apos;s why we immediately execute OSAllocator::commit after that.
&gt;&gt;&gt; 
&gt;&gt;&gt; For the case of the small size, memset(...) would be nice here.
&gt;&gt;&gt; I don&apos;t think memset all the area of this here, it exhausts memory even if it is not used.
&gt;&gt;&gt; The threshold should be decided based on the result of some benchmark.
&gt;&gt; 
&gt;&gt; I mean, I don&apos;t think clearing all the area here by using memset is good way. I t exhausts memory even if it is not used. (And currently, it exhausts memory in Linux).
&gt; 
&gt; It exhausts memory also on Mac.
&gt; 
&gt; Basically this test is asking for _two_ memory segments with an _initial_ size of 4GBs.
&gt; 
&gt; See https://trac.webkit.org/browser/trunk/JSTests/wasm/js-api/test_memory_constructor.js?rev=220265#L44
&gt; and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory
&gt; 
&gt; And 6 subtests are executed on parallel. So...., the only way this test can run fine is if your machine has 48GB of RAM.
&gt; 
&gt; On Mac it throws an error (therefore the messages I saw here https://bugs.webkit.org/show_bug.cgi?id=175150#c18 about dmesg).
&gt; On Linux it either does the same (throw) or gets killed by the Linux OOM killer.
&gt; 
&gt; On Mac causing an OOM condition seems more or less fine (you maybe even don&apos;t notice). On Linux is not fine. Your computer will freeze for several seconds.  A similar issue was discussed on bug 175100
&gt; 
&gt; 
&gt; Do we really need to try to allocate so much memory for this test? The Mac JSC bots &quot;only&quot; have 16GBs of RAM. I think this test is really throwing exceptions there because there is not enough memory to run the 6 subtests at the same time. And instead of testing what it was meant to test, its testing that it can throw an error (that is catched) for not enough memory.
&gt; 
&gt; However, I think this patch is a really interesting approach and can make things better when some application requests more initial memory than it will really needs. Ideally this should be done with some heuristics based on the requested size. If the size is small using memset(0) is probably better than calling MADV_DONTNEED. I&apos;m speculating here as I have no real idea, some benchmark or empiric testing will be needed.

I agree with Carlos that we should not have a test that allocates 4GB of RAM, unless some precautions are taken, like putting &quot;//@ runDefault&quot; at the top to make it only run one of the configurations instead of N.  Also, instead of allocating 4GB, we should think hard about what we can do to test the same code by requesting less memory.  If it&apos;s an OOM test, we could add options to force the memory allocator to assume that there is less memory than there really is, so that we can drive the VM to OOM in a more reasonable amount of memory.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1336353</commentid>
    <comment_count>33</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2017-08-07 21:42:56 -0700</bug_when>
    <thetext>(In reply to Filip Pizlo from comment #32)
&gt; Comment on attachment 317404 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=317404&amp;action=review
&gt; 
&gt; This patch seems sensible to me.  r=me.
&gt; 
&gt; &gt;&gt;&gt;&gt;&gt;&gt; Source/JavaScriptCore/wasm/WasmMemory.cpp:263
&gt; &gt;&gt;&gt;&gt;&gt;&gt; +    while (madvise(startAddress, sizeInBytes, MADV_DONTNEED) == -1 &amp;&amp; errno == EAGAIN) { }
&gt; &gt;&gt;&gt;&gt;&gt; 
&gt; &gt;&gt;&gt;&gt;&gt; This feels wrong. The programmer is telling us they need this memory (most likely because they will run a wasm program and access it), but you’re telling the kernel you don’t expect this memory to be accessed anytime soon. This feels wrong, and it seems possible that it will slow down actual Wasm programs.
&gt; &gt;&gt;&gt;&gt; 
&gt; &gt;&gt;&gt;&gt; That&apos;s why we immediately execute OSAllocator::commit after that.
&gt; &gt;&gt;&gt; 
&gt; &gt;&gt;&gt; For the case of the small size, memset(...) would be nice here.
&gt; &gt;&gt;&gt; I don&apos;t think memset all the area of this here, it exhausts memory even if it is not used.
&gt; &gt;&gt;&gt; The threshold should be decided based on the result of some benchmark.
&gt; &gt;&gt; 
&gt; &gt;&gt; I mean, I don&apos;t think clearing all the area here by using memset is good way. I t exhausts memory even if it is not used. (And currently, it exhausts memory in Linux).
&gt; &gt; 
&gt; &gt; It exhausts memory also on Mac.
&gt; &gt; 
&gt; &gt; Basically this test is asking for _two_ memory segments with an _initial_ size of 4GBs.
&gt; &gt; 
&gt; &gt; See https://trac.webkit.org/browser/trunk/JSTests/wasm/js-api/test_memory_constructor.js?rev=220265#L44
&gt; &gt; and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory
&gt; &gt; 
&gt; &gt; And 6 subtests are executed on parallel. So...., the only way this test can run fine is if your machine has 48GB of RAM.
&gt; &gt; 
&gt; &gt; On Mac it throws an error (therefore the messages I saw here https://bugs.webkit.org/show_bug.cgi?id=175150#c18 about dmesg).
&gt; &gt; On Linux it either does the same (throw) or gets killed by the Linux OOM killer.
&gt; &gt; 
&gt; &gt; On Mac causing an OOM condition seems more or less fine (you maybe even don&apos;t notice). On Linux is not fine. Your computer will freeze for several seconds.  A similar issue was discussed on bug 175100
&gt; &gt; 
&gt; &gt; 
&gt; &gt; Do we really need to try to allocate so much memory for this test? The Mac JSC bots &quot;only&quot; have 16GBs of RAM. I think this test is really throwing exceptions there because there is not enough memory to run the 6 subtests at the same time. And instead of testing what it was meant to test, its testing that it can throw an error (that is catched) for not enough memory.
&gt; &gt; 
&gt; &gt; However, I think this patch is a really interesting approach and can make things better when some application requests more initial memory than it will really needs. Ideally this should be done with some heuristics based on the requested size. If the size is small using memset(0) is probably better than calling MADV_DONTNEED. I&apos;m speculating here as I have no real idea, some benchmark or empiric testing will be needed.
&gt; 
&gt; I agree with Carlos that we should not have a test that allocates 4GB of
&gt; RAM, unless some precautions are taken, like putting &quot;//@ runDefault&quot; at the
&gt; top to make it only run one of the configurations instead of N.  Also,
&gt; instead of allocating 4GB, we should think hard about what we can do to test
&gt; the same code by requesting less memory.  If it&apos;s an OOM test, we could add
&gt; options to force the memory allocator to assume that there is less memory
&gt; than there really is, so that we can drive the VM to OOM in a more
&gt; reasonable amount of memory.

I don&apos;t think the test is stressing OOM as far as I remember. I&apos;m ok with just setting it to @runDefault</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1336356</commentid>
    <comment_count>34</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2017-08-07 21:44:31 -0700</bug_when>
    <thetext>(In reply to Yusuke Suzuki from comment #28)
&gt; Comment on attachment 317404 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=317404&amp;action=review
&gt; 
&gt; &gt;&gt; Source/JavaScriptCore/wasm/WasmMemory.cpp:263
&gt; &gt;&gt; +    while (madvise(startAddress, sizeInBytes, MADV_DONTNEED) == -1 &amp;&amp; errno == EAGAIN) { }
&gt; &gt; 
&gt; &gt; This feels wrong. The programmer is telling us they need this memory (most likely because they will run a wasm program and access it), but you’re telling the kernel you don’t expect this memory to be accessed anytime soon. This feels wrong, and it seems possible that it will slow down actual Wasm programs.
&gt; 
&gt; That&apos;s why we immediately execute OSAllocator::commit after that.

This makes sense.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1336357</commentid>
    <comment_count>35</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2017-08-07 21:45:09 -0700</bug_when>
    <thetext>I just reread the test again. It&apos;s asking for the largest possible amount of memory that is legal for a WebAssembly.memory. It seems reasonable to only run this once, or to revise the test to be less crazy.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1336358</commentid>
    <comment_count>36</comment_count>
      <attachid>317404</attachid>
    <who name="Saam Barati">saam</who>
    <bug_when>2017-08-07 21:49:58 -0700</bug_when>
    <thetext>Comment on attachment 317404
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=317404&amp;action=review

&gt; Source/JavaScriptCore/wasm/WasmMemory.cpp:269
&gt; +    bool writable = true;
&gt; +    bool executable = false;

Nit: these variables can be defined outside of the #if</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1336446</commentid>
    <comment_count>37</comment_count>
      <attachid>317404</attachid>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-08-08 05:59:53 -0700</bug_when>
    <thetext>Comment on attachment 317404
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=317404&amp;action=review

&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; Source/JavaScriptCore/wasm/WasmMemory.cpp:263
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; +    while (madvise(startAddress, sizeInBytes, MADV_DONTNEED) == -1 &amp;&amp; errno == EAGAIN) { }
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; 
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; This feels wrong. The programmer is telling us they need this memory (most likely because they will run a wasm program and access it), but you’re telling the kernel you don’t expect this memory to be accessed anytime soon. This feels wrong, and it seems possible that it will slow down actual Wasm programs.
&gt;&gt;&gt;&gt;&gt;&gt;&gt; 
&gt;&gt;&gt;&gt;&gt;&gt;&gt; That&apos;s why we immediately execute OSAllocator::commit after that.
&gt;&gt;&gt;&gt;&gt;&gt; 
&gt;&gt;&gt;&gt;&gt;&gt; For the case of the small size, memset(...) would be nice here.
&gt;&gt;&gt;&gt;&gt;&gt; I don&apos;t think memset all the area of this here, it exhausts memory even if it is not used.
&gt;&gt;&gt;&gt;&gt;&gt; The threshold should be decided based on the result of some benchmark.
&gt;&gt;&gt;&gt;&gt; 
&gt;&gt;&gt;&gt;&gt; I mean, I don&apos;t think clearing all the area here by using memset is good way. I t exhausts memory even if it is not used. (And currently, it exhausts memory in Linux).
&gt;&gt;&gt;&gt; 
&gt;&gt;&gt;&gt; It exhausts memory also on Mac.
&gt;&gt;&gt;&gt; 
&gt;&gt;&gt;&gt; Basically this test is asking for _two_ memory segments with an _initial_ size of 4GBs.
&gt;&gt;&gt;&gt; 
&gt;&gt;&gt;&gt; See https://trac.webkit.org/browser/trunk/JSTests/wasm/js-api/test_memory_constructor.js?rev=220265#L44
&gt;&gt;&gt;&gt; and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory
&gt;&gt;&gt;&gt; 
&gt;&gt;&gt;&gt; And 6 subtests are executed on parallel. So...., the only way this test can run fine is if your machine has 48GB of RAM.
&gt;&gt;&gt;&gt; 
&gt;&gt;&gt;&gt; On Mac it throws an error (therefore the messages I saw here https://bugs.webkit.org/show_bug.cgi?id=175150#c18 about dmesg).
&gt;&gt;&gt;&gt; On Linux it either does the same (throw) or gets killed by the Linux OOM killer.
&gt;&gt;&gt;&gt; 
&gt;&gt;&gt;&gt; On Mac causing an OOM condition seems more or less fine (you maybe even don&apos;t notice). On Linux is not fine. Your computer will freeze for several seconds.  A similar issue was discussed on bug 175100
&gt;&gt;&gt;&gt; 
&gt;&gt;&gt;&gt; 
&gt;&gt;&gt;&gt; Do we really need to try to allocate so much memory for this test? The Mac JSC bots &quot;only&quot; have 16GBs of RAM. I think this test is really throwing exceptions there because there is not enough memory to run the 6 subtests at the same time. And instead of testing what it was meant to test, its testing that it can throw an error (that is catched) for not enough memory.
&gt;&gt;&gt;&gt; 
&gt;&gt;&gt;&gt; However, I think this patch is a really interesting approach and can make things better when some application requests more initial memory than it will really needs. Ideally this should be done with some heuristics based on the requested size. If the size is small using memset(0) is probably better than calling MADV_DONTNEED. I&apos;m speculating here as I have no real idea, some benchmark or empiric testing will be needed.
&gt;&gt;&gt; 
&gt;&gt;&gt; I agree with Carlos that we should not have a test that allocates 4GB of RAM, unless some precautions are taken, like putting &quot;//@ runDefault&quot; at the top to make it only run one of the configurations instead of N.  Also, instead of allocating 4GB, we should think hard about what we can do to test the same code by requesting less memory.  If it&apos;s an OOM test, we could add options to force the memory allocator to assume that there is less memory than there really is, so that we can drive the VM to OOM in a more reasonable amount of memory.
&gt;&gt; 
&gt;&gt; I don&apos;t think the test is stressing OOM as far as I remember. I&apos;m ok with just setting it to @runDefault
&gt; 
&gt; This makes sense.

OK, I filed the separate bug for runWebAssemblyDefault thing.

&gt;&gt; Source/JavaScriptCore/wasm/WasmMemory.cpp:269
&gt;&gt; +    bool executable = false;
&gt; 
&gt; Nit: these variables can be defined outside of the #if

Nice, fixed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1336453</commentid>
    <comment_count>38</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-08-08 06:11:05 -0700</bug_when>
    <thetext>Committed r220401: &lt;http://trac.webkit.org/changeset/220401&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>317140</attachid>
            <date>2017-08-03 13:04:23 -0700</date>
            <delta_ts>2017-08-05 10:52:44 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-175150-20170803220422.patch</filename>
            <type>text/plain</type>
            <size>1175</size>
            <attacher name="Carlos Alberto Lopez Perez">clopez</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjIwMjIxCmRpZmYgLS1naXQgYS9KU1Rlc3RzL0NoYW5nZUxv
ZyBiL0pTVGVzdHMvQ2hhbmdlTG9nCmluZGV4IGI2NTk2ZDhiZGRmMGMyMjhiYmJlMTFkNjRjNGY0
ZTIyOGY1NGNlMGUuLjk5NGEyOTMyYTVlZTI1OWM1NjJiNDMxNWE2ZTYxNjAwMmUxZjE0OTEgMTAw
NjQ0Ci0tLSBhL0pTVGVzdHMvQ2hhbmdlTG9nCisrKyBiL0pTVGVzdHMvQ2hhbmdlTG9nCkBAIC0x
LDMgKzEsMTIgQEAKKzIwMTctMDgtMDMgIENhcmxvcyBBbGJlcnRvIExvcGV6IFBlcmV6ICA8Y2xv
cGV6QGlnYWxpYS5jb20+CisKKyAgICAgICAgSlNDIHRlc3Qgd2FzbS9qcy1hcGkvdGVzdF9tZW1v
cnlfY29uc3RydWN0b3IuanMgc2hvdWxkIGJlIHNraXBwZWQgb24gbWVtb3J5TGltaXRlZAorICAg
ICAgICBodHRwczovL2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9MTc1MTUwCisKKyAg
ICAgICAgUmV2aWV3ZWQgYnkgTk9CT0RZIChPT1BTISkuCisKKyAgICAgICAgKiB3YXNtL2pzLWFw
aS90ZXN0X21lbW9yeV9jb25zdHJ1Y3Rvci5qczoKKwogMjAxNy0wOC0wMiAgQ2FybG9zIEFsYmVy
dG8gTG9wZXogUGVyZXogIDxjbG9wZXpAaWdhbGlhLmNvbT4KIAogICAgICAgICBbTGludXhdIEpT
VGVzdHMvd2FzbS9zdHJlc3Mvb29tLmpzIHNob3VsZCBub3QgcnVuIG9uIExpbnV4CmRpZmYgLS1n
aXQgYS9KU1Rlc3RzL3dhc20vanMtYXBpL3Rlc3RfbWVtb3J5X2NvbnN0cnVjdG9yLmpzIGIvSlNU
ZXN0cy93YXNtL2pzLWFwaS90ZXN0X21lbW9yeV9jb25zdHJ1Y3Rvci5qcwppbmRleCBlNjdkZjky
YWRmYjk2Y2JlYmJlYzFjMTRjM2RhZmYxZTJkZGU2MTBlLi5iODg5M2VhYjdhZjJmYWMwZWEzNDhj
NWVlNTI1NjdjM2NlNTRjNmQ5IDEwMDY0NAotLS0gYS9KU1Rlc3RzL3dhc20vanMtYXBpL3Rlc3Rf
bWVtb3J5X2NvbnN0cnVjdG9yLmpzCisrKyBiL0pTVGVzdHMvd2FzbS9qcy1hcGkvdGVzdF9tZW1v
cnlfY29uc3RydWN0b3IuanMKQEAgLTEsNCArMSw1IEBACiAvLyBGSVhNRTogdXNlIHRoZSBhc3Nl
cnQgbGlicmFyeTogaHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTE2NTY4
NAorLy9AIHNraXAgaWYgJG1lbW9yeUxpbWl0ZWQKIGltcG9ydCBCdWlsZGVyIGZyb20gJy4uL0J1
aWxkZXIuanMnOwogCiBmdW5jdGlvbiBhc3NlcnQoYikgewo=
</data>

          </attachment>
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>317342</attachid>
            <date>2017-08-05 10:52:49 -0700</date>
            <delta_ts>2017-08-06 12:09:57 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-175150-20170806025248.patch</filename>
            <type>text/plain</type>
            <size>3434</size>
            <attacher name="Yusuke Suzuki">ysuzuki</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjIwMzE4CmRpZmYgLS1naXQgYS9Tb3VyY2UvSmF2YVNjcmlw
dENvcmUvQ2hhbmdlTG9nIGIvU291cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwppbmRleCBk
MGNkZDM5YmQ0YzQ1NGNlNjEwMD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FnZXMoc3RhcnRBZGRyZXNzLCBleHRy
YUJ5dGVzKTsKICAgICAgICAgbV9zaXplID0gZGVzaXJlZFNpemU7CiAgICAgICAgIHJldHVybiB0
cnVlOwogICAgIH0gfQo=
</data>

          </attachment>
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>317375</attachid>
            <date>2017-08-06 12:09:59 -0700</date>
            <delta_ts>2017-08-06 23:46:54 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-175150-20170807040958.patch</filename>
            <type>text/plain</type>
            <size>4657</size>
            <attacher name="Yusuke Suzuki">ysuzuki</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjIwMzI0CmRpZmYgLS1naXQgYS9Tb3VyY2UvSmF2YVNjcmlw
dENvcmUvQ2hhbmdlTG9nIGIvU291cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwppbmRleCAw
ZTIzZWYyZWM3YzAwOWMxYzhjNzMyNDgyZDJmOTI5NDIxMWI3ZmZiLi4xNjFkZmNiZjMyMTU0NDI2
MjVlYWQyYWQ2OGQ5MTZhMzViN2FlNjk1IDEwMDY0NAotLS0gYS9Tb3VyY2UvSmF2YVNjcmlwdENv
cmUvQ2hhbmdlTG9nCisrKyBiL1NvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cKQEAgLTEs
NSArMSwyNCBAQAogMjAxNy0wOC0wNiAgWXVzdWtlIFN1enVraSAgPHV0YXRhbmUudGVhQGdtYWls
LmNvbT4KIAorICAgICAgICBbTGludXhdIENsZWFyIFdhc21NZW1vcnkgd2l0aCBtYWR2aWNlIGlu
c3RlYWQgb2YgbWVtc2V0CisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQub3JnL3Nob3dfYnVn
LmNnaT9pZD0xNzUxNTAKKworICAgICAgICBSZXZpZXdlZCBieSBOT0JPRFkgKE9PUFMhKS4KKwor
ICAgICAgICBJbiBMaW51eCwgemVyb2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wczovL2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9
MTY1Njg0Ci0vL0Agc2tpcCBpZiAkbWVtb3J5TGltaXRlZAogaW1wb3J0IEJ1aWxkZXIgZnJvbSAn
Li4vQnVpbGRlci5qcyc7CiAKIGZ1bmN0aW9uIGFzc2VydChiKSB7Cg==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>317404</attachid>
            <date>2017-08-06 23:46:57 -0700</date>
            <delta_ts>2017-08-07 10:18:33 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-175150-20170807154656.patch</filename>
            <type>text/plain</type>
            <size>3497</size>
            <attacher name="Yusuke Suzuki">ysuzuki</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjIwMzI0CmRpZmYgLS1naXQgYS9Tb3VyY2UvSmF2YVNjcmlw
dENvcmUvQ2hhbmdlTG9nIGIvU291cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwppbmRleCAw
ZTIzZWYyZWM3YzAwOWMxYzhjNzMyNDgyZDJmOTI5NDIxMWI3ZmZiLi4xNjFkZmNiZjMyMTU0NDI2
MjVlYWQyYWQ2OGQ5MTZhMzViN2FlNjk1IDEwMDY0NAotLS0gYS9Tb3VyY2UvSmF2YVNjcmlwdENv
cmUvQ2hhbmdlTG9nCisrKyBiL1NvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cKQEAgLTEs
NSArMSwyNCBAQAogMjAxNy0wOC0wNiAgWXVzdWtlIFN1enVraSAgPHV0YXRhbmUudGVhQGdtYWls
LmNvbT4KIAorICAgICAgICBbTGludXhdIENsZWFyIFdhc21NZW1vcnkgd2l0aCBtYWR2aWNlIGlu
c3RlYWQgb2YgbWVtc2V0CisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQub3JnL3Nob3dfYnVn
LmNnaT9pZD0xNzUxNTAKKworICAgICAgICB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FTRV9BU1NFUlRfTk9UX1JFQUNIRUQoKTsK
ICAgICAgICAgfQorCisgICAgICAgIGNvbW1pdFplcm9QYWdlcyhmYXN0TWVtb3J5LCBpbml0aWFs
Qnl0ZXMpOwogICAgICAgICAKLSAgICAgICAgbWVtc2V0KGZhc3RNZW1vcnksIDAsIGluaXRpYWxC
eXRlcyk7CiAgICAgICAgIHJldHVybiBhZG9wdFJlZihuZXcgTWVtb3J5KGZhc3RNZW1vcnksIGlu
aXRpYWwsIG1heGltdW0sIE1lbW9yeTo6ZmFzdE1hcHBlZEJ5dGVzKCksIE1lbW9yeU1vZGU6OlNp
Z25hbGluZykpOwogICAgIH0KICAgICAKQEAgLTQwMCw3ICs0MTUsNyBAQCBib29sIE1lbW9yeTo6
Z3JvdyhWTSYgdm0sIFBhZ2VDb3VudCBuZXdTaXplKQogICAgICAgICAgICAgZGF0YUxvZ0xuSWYo
dmVyYm9zZSwgIk1lbW9yeTo6Z3JvdyBpbi1wbGFjZSBmYWlsZWQgIiwgKnRoaXMpOwogICAgICAg
ICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICB9Ci0gICAgICAgIG1lbXNldChzdGFydEFkZHJl
c3MsIDAsIGV4dHJhQnl0ZXMpOworICAgICAgICBjb21taXRaZXJvUGFnZXMoc3RhcnRBZGRyZXNz
LCBleHRyYUJ5dGVzKTsKICAgICAgICAgbV9zaXplID0gZGVzaXJlZFNpemU7CiAgICAgICAgIHJl
dHVybiB0cnVlOwogICAgIH0gfQo=
</data>
<flag name="review"
          id="337961"
          type_id="1"
          status="+"
          setter="fpizlo"
    />
          </attachment>
      

    </bug>

</bugzilla>