X-Git-Url: https://git.openfabrics.org/?p=~shefty%2Frdma-dev.git;a=blobdiff_plain;f=mm%2Fmmap.c;h=f940062c8d4b7dd50a619663c49fde83b40e3f61;hp=5646677a96d591f5ab1179473b3f4938d42d0ded;hb=608ff1a210ab0e8b969399039bf8e18693605910;hpb=74d42d8fe146e870c52bde3b1c692f86cc8ff844 diff --git a/mm/mmap.c b/mm/mmap.c index 5646677a96d..f940062c8d4 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -89,6 +89,20 @@ int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT; */ struct percpu_counter vm_committed_as ____cacheline_aligned_in_smp; +/* + * The global memory commitment made in the system can be a metric + * that can be used to drive ballooning decisions when Linux is hosted + * as a guest. On Hyper-V, the host implements a policy engine for dynamically + * balancing memory across competing virtual machines that are hosted. + * Several metrics drive this policy engine including the guest reported + * memory commitment. + */ +unsigned long vm_memory_committed(void) +{ + return percpu_counter_read_positive(&vm_committed_as); +} +EXPORT_SYMBOL_GPL(vm_memory_committed); + /* * Check that a process has enough memory to allocate a new virtual * mapping. 0 means there is enough memory for the allocation to