Skip to content

Commit 26e8cc8

Browse files
authored
Remove cached cgroup values (#102971) (#103166)
1 parent 7446a8b commit 26e8cc8

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

src/coreclr/gc/env/gcenv.os.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ class GCToOSInterface
417417
// Remarks:
418418
// If a process runs with a restricted memory limit, it returns the limit. If there's no limit
419419
// specified, it returns amount of actual physical memory.
420-
static uint64_t GetPhysicalMemoryLimit(bool* is_restricted=NULL);
420+
static uint64_t GetPhysicalMemoryLimit(bool* is_restricted=NULL, bool refresh=false);
421421

422422
// Get memory status
423423
// Parameters:

src/coreclr/gc/gc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52808,7 +52808,7 @@ int gc_heap::refresh_memory_limit()
5280852808
size_t old_heap_hard_limit_poh = heap_hard_limit_oh[poh];
5280952809
bool old_hard_limit_config_p = hard_limit_config_p;
5281052810

52811-
total_physical_mem = GCToOSInterface::GetPhysicalMemoryLimit (&is_restricted_physical_mem);
52811+
total_physical_mem = GCToOSInterface::GetPhysicalMemoryLimit (&is_restricted_physical_mem, true);
5281252812

5281352813
bool succeed = true;
5281452814

src/coreclr/gc/unix/gcenv.unix.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,14 +1121,13 @@ size_t GCToOSInterface::GetVirtualMemoryLimit()
11211121
// Remarks:
11221122
// If a process runs with a restricted memory limit, it returns the limit. If there's no limit
11231123
// specified, it returns amount of actual physical memory.
1124-
uint64_t GCToOSInterface::GetPhysicalMemoryLimit(bool* is_restricted)
1124+
uint64_t GCToOSInterface::GetPhysicalMemoryLimit(bool* is_restricted, bool refresh)
11251125
{
11261126
size_t restricted_limit;
11271127
if (is_restricted)
11281128
*is_restricted = false;
11291129

1130-
// The limit was not cached
1131-
if (g_RestrictedPhysicalMemoryLimit == 0)
1130+
if (g_RestrictedPhysicalMemoryLimit == 0 || refresh)
11321131
{
11331132
restricted_limit = GetRestrictedPhysicalMemoryLimit();
11341133
VolatileStore(&g_RestrictedPhysicalMemoryLimit, restricted_limit);

src/coreclr/gc/windows/gcenv.windows.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ size_t GCToOSInterface::GetVirtualMemoryLimit()
960960
// Remarks:
961961
// If a process runs with a restricted memory limit, it returns the limit. If there's no limit
962962
// specified, it returns amount of actual physical memory.
963-
uint64_t GCToOSInterface::GetPhysicalMemoryLimit(bool* is_restricted)
963+
uint64_t GCToOSInterface::GetPhysicalMemoryLimit(bool* is_restricted, bool refresh)
964964
{
965965
if (is_restricted)
966966
*is_restricted = false;

0 commit comments

Comments
 (0)