Skip to content

Commit fda93d8

Browse files
committed
Apply scaling reserved RAM to large runners only
1 parent 18ae981 commit fda93d8

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

lib/util.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/util.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/util.test.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/util.test.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/util.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,21 @@ const GET_MEMORY_FLAG_TESTS = [
2525
totalMemoryMb: 8 * 1024,
2626
platform: "linux",
2727
expectedMemoryValue: 7 * 1024,
28-
expectedMemoryValueWithScaling: 7004, // Math.floor(1024 * (8*0.98 - 1))
28+
expectedMemoryValueWithScaling: 7 * 1024,
2929
},
3030
{
3131
input: undefined,
3232
totalMemoryMb: 8 * 1024,
3333
platform: "win32",
3434
expectedMemoryValue: 6.5 * 1024,
35-
expectedMemoryValueWithScaling: 6492, // Math.floor(1024 * (8*0.98 - 1.5))
35+
expectedMemoryValueWithScaling: 6.5 * 1024,
3636
},
3737
{
3838
input: "",
3939
totalMemoryMb: 8 * 1024,
4040
platform: "linux",
4141
expectedMemoryValue: 7 * 1024,
42-
expectedMemoryValueWithScaling: 7004, // Math.floor(1024 * (8*0.98 - 1))
42+
expectedMemoryValueWithScaling: 7 * 1024,
4343
},
4444
{
4545
input: "512",
@@ -53,14 +53,14 @@ const GET_MEMORY_FLAG_TESTS = [
5353
totalMemoryMb: 64 * 1024,
5454
platform: "linux",
5555
expectedMemoryValue: 63 * 1024,
56-
expectedMemoryValueWithScaling: 63201, // Math.floor(1024 * (64*0.98 - 1))
56+
expectedMemoryValueWithScaling: 63078, // Math.floor(1024 * (64 - 1 - 0.025 * (64 - 8)))
5757
},
5858
{
5959
input: undefined,
6060
totalMemoryMb: 64 * 1024,
6161
platform: "win32",
6262
expectedMemoryValue: 62.5 * 1024,
63-
expectedMemoryValueWithScaling: 62689, // Math.floor(1024 * (64*0.98 - 1.5))
63+
expectedMemoryValueWithScaling: 62566, // Math.floor(1024 * (64 - 1.5 - 0.025 * (64 - 8)))
6464
},
6565
];
6666

src/util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ function getSystemReservedMemoryMegaBytes(
160160
const fixedAmount = 1024 * (platform === "win32" ? 1.5 : 1);
161161

162162
if (isScalingReservedRamEnabled) {
163-
// Reserve an additional 2% of the total memory, since the amount used by
163+
// Reserve an additional 2.5% of the amount of memory above 8 GB, since the amount used by
164164
// the kernel for page tables scales with the size of physical memory.
165-
const scaledAmount = 0.02 * totalMemoryMegaBytes;
165+
const scaledAmount = 0.025 * Math.max(totalMemoryMegaBytes - 8 * 1024, 0);
166166
return fixedAmount + scaledAmount;
167167
} else {
168168
return fixedAmount;

0 commit comments

Comments
 (0)