Skip to content

Commit 361ce67

Browse files
Googlercopybara-github
authored andcommitted
Remove experimental_local_memory_estimate flag.
The logic under this flag is incorrect. We have estimation like: ```remainingFreeRAM = TotalFreeRAM - TotalAvailableForBlazeRAM``` , but this doesn't make sense, and covers to zero in many cases. RELNOTES[INC]: Flag --experimental_local_memory_estimate removed. PiperOrigin-RevId: 458228240 Change-Id: I8b9b05a9b994cbc8170b1a44d0367a7742270a0d
1 parent 8ba9096 commit 361ce67

File tree

4 files changed

+9
-46
lines changed

4 files changed

+9
-46
lines changed

src/main/java/com/google/devtools/build/lib/actions/ResourceManager.java

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe;
2222
import com.google.devtools.build.lib.profiler.AutoProfiler;
2323
import com.google.devtools.build.lib.profiler.ProfilerTask;
24-
import com.google.devtools.build.lib.unix.ProcMeminfoParser;
25-
import com.google.devtools.build.lib.util.OS;
2624
import com.google.devtools.build.lib.util.Pair;
2725
import com.google.devtools.build.lib.worker.Worker;
2826
import com.google.devtools.build.lib.worker.WorkerKey;
@@ -178,9 +176,6 @@ public static ResourceManager instance() {
178176
// Used local test count. Corresponds to the local test count definition in the ResourceSet class.
179177
private int usedLocalTestCount;
180178

181-
// Determines if local memory estimates are used.
182-
private boolean localMemoryEstimate = false;
183-
184179
/** If set, local-only actions are given priority over dynamically run actions. */
185180
private boolean prioritizeLocalActions;
186181

@@ -231,14 +226,6 @@ public synchronized void setAvailableResources(ResourceSet resources) {
231226
staticResources.getLocalTestCount());
232227
}
233228

234-
/**
235-
* If set to true, then resource acquisition will query the currently available memory, rather
236-
* than counting it against the fixed maximum size.
237-
*/
238-
public void setUseLocalMemoryEstimate(boolean value) {
239-
localMemoryEstimate = value;
240-
}
241-
242229
/** Sets worker pool for taking the workers. Must be called before requesting the workers. */
243230
public void setWorkerPool(WorkerPool workerPool) {
244231
this.workerPool = workerPool;
@@ -475,23 +462,6 @@ private boolean areResourcesAvailable(ResourceSet resources) {
475462

476463
double remainingRam = availableRam - usedRam;
477464

478-
if (localMemoryEstimate && OS.getCurrent() == OS.LINUX) {
479-
try {
480-
ProcMeminfoParser memInfo = new ProcMeminfoParser();
481-
double totalFreeRam = memInfo.getFreeRamKb() / 1024.0;
482-
double reserveMemory = staticResources.getMemoryMb();
483-
remainingRam = totalFreeRam - reserveMemory;
484-
} catch (IOException e) {
485-
// If we get an error trying to determine the currently free system memory for any reason,
486-
// just continue on. It is not terribly clear what could cause this, aside from an
487-
// unexpected ABI breakage in the linux kernel or an OS-level misconfiguration such as not
488-
// having permissions to read /proc/meminfo.
489-
//
490-
// remainingRam is initialized to a value that results in behavior as if localMemoryEstimate
491-
// was disabled.
492-
}
493-
}
494-
495465
WorkerKey workerKey = resources.getWorkerKey();
496466
int availableWorkers = 0;
497467
int activeWorkers = 0;

src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRulesModule.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,15 @@ public static final class BazelBuildGraveyardOptions extends BuildGraveyardOptio
434434
metadataTags = {OptionMetadataTag.INCOMPATIBLE_CHANGE},
435435
help = "No-op")
436436
public boolean dontUseJavaSourceInfoProvider;
437+
438+
@Option(
439+
name = "experimental_local_memory_estimate",
440+
defaultValue = "false",
441+
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
442+
metadataTags = {OptionMetadataTag.DEPRECATED},
443+
effectTags = {OptionEffectTag.NO_OP},
444+
help = "No-op.")
445+
public boolean localMemoryEstimate;
437446
}
438447

439448
/**

src/main/java/com/google/devtools/build/lib/buildtool/ExecutionTool.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,6 @@ private Builder createBuilder(
930930
public static void configureResourceManager(ResourceManager resourceMgr, BuildRequest request) {
931931
ExecutionOptions options = request.getOptions(ExecutionOptions.class);
932932
resourceMgr.setPrioritizeLocalActions(options.prioritizeLocalActions);
933-
resourceMgr.setUseLocalMemoryEstimate(options.localMemoryEstimate);
934933
resourceMgr.setAvailableResources(
935934
ResourceSet.create(
936935
options.localRamResources,

src/main/java/com/google/devtools/build/lib/exec/ExecutionOptions.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -325,21 +325,6 @@ public boolean shouldMaterializeParamFiles() {
325325
converter = RamResourceConverter.class)
326326
public float localRamResources;
327327

328-
@Option(
329-
name = "experimental_local_memory_estimate",
330-
defaultValue = "false",
331-
documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
332-
effectTags = {OptionEffectTag.UNKNOWN},
333-
help =
334-
"Estimate the actual memory available online. "
335-
+ "By default, Blaze assumes most actions use a fixed amount of memory, and counts "
336-
+ "that against the total available system memory, regardless of how much memory is "
337-
+ "actually available. This option enables online estimation of how much memory is "
338-
+ "available at any given time, and thus does not require accurate estimation of how "
339-
+ "much memory a given action will take."
340-
)
341-
public boolean localMemoryEstimate;
342-
343328
@Option(
344329
name = "local_test_jobs",
345330
defaultValue = "auto",

0 commit comments

Comments
 (0)