Chromium Code Reviews| Index: content/browser/memory/memory_monitor_chromeos.cc |
| diff --git a/content/browser/memory/memory_monitor_chromeos.cc b/content/browser/memory/memory_monitor_chromeos.cc |
| index 6dae24735c2c3133658bfbcf478ce39f1c68957e..36d8ff87c9bd7530c9cba891b407a58bf9db62a1 100644 |
| --- a/content/browser/memory/memory_monitor_chromeos.cc |
| +++ b/content/browser/memory/memory_monitor_chromeos.cc |
| @@ -25,11 +25,9 @@ int MemoryMonitorChromeOS::GetFreeMemoryUntilCriticalMB() { |
| base::SystemMemoryInfoKB mem_info = {}; |
| delegate_->GetSystemMemoryInfo(&mem_info); |
| - // The available memory consists of "real" and virtual (z)ram memory. |
| - // Since swappable memory uses a non pre-deterministic compression and |
| - // the compression creates its own "dynamic" in the system, it gets |
| - // de-emphasized by the |kSwapWeight| factor. |
| - const int kSwapWeight = 4; |
| + // Use available free memory provided by the OS if the OS supports it. |
| + if (mem_info.available > 0) |
| + return mem_info.available >> kShiftKiBtoMiB; |
| // The kernel internally uses 50MB. |
| const int kMinFileMemory = 50 * 1024; |
| @@ -39,9 +37,8 @@ int MemoryMonitorChromeOS::GetFreeMemoryUntilCriticalMB() { |
| // unless it is dirty or it's a minimal portion which is required. |
| file_memory -= mem_info.dirty + kMinFileMemory; |
|
Wez
2017/03/08 01:59:05
Is there a risk of |file_memory| ending up -ve as
bashi
2017/03/10 01:59:10
Actually I'm not sure. Looks like this is a simple
|
| - // Available memory is the sum of free, swap and easy reclaimable memory. |
| - return (mem_info.free + mem_info.swap_free / kSwapWeight + file_memory) >> |
| - kShiftKiBtoMiB; |
| + // Available memory is the sum of free and easy reclaimable memory. |
| + return (mem_info.free + file_memory) >> kShiftKiBtoMiB; |
| } |
| // static |