aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/xen/tmem_xen.h
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-12-09 10:44:56 +0000
committerKeir Fraser <keir.fraser@citrix.com>2009-12-09 10:44:56 +0000
commit51010e4de3d40cd83549768c2cf10ecdcf6ee4a8 (patch)
treeea18e6921dd14d075e32d4b263cb6a16d674203c /xen/include/xen/tmem_xen.h
parent9905ac2b90a3e7cecd9e7dfe21c252362e7080b2 (diff)
downloadxen-51010e4de3d40cd83549768c2cf10ecdcf6ee4a8.tar.gz
xen-51010e4de3d40cd83549768c2cf10ecdcf6ee4a8.tar.bz2
xen-51010e4de3d40cd83549768c2cf10ecdcf6ee4a8.zip
tmem: reclaim minimal memory proactively
When a single domain is using most/all of tmem memory for ephemeral pages belonging to the same object, e.g. when copying a single huge file larger than ephemeral memory, long lists are traversed looking for a page to evict that doesn't belong to this object (as pages in the object for which a page is currently being inserted are locked and cannot be evicted). This is essentially a livelock. Avoid this by proactively ensuring there is a margin of available memory (1MB) before locks are taken on the object. Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Diffstat (limited to 'xen/include/xen/tmem_xen.h')
-rw-r--r--xen/include/xen/tmem_xen.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/xen/include/xen/tmem_xen.h b/xen/include/xen/tmem_xen.h
index 90b860a5f9..6095db8248 100644
--- a/xen/include/xen/tmem_xen.h
+++ b/xen/include/xen/tmem_xen.h
@@ -252,6 +252,11 @@ static inline unsigned long tmh_freeable_mb(void)
(20 - PAGE_SHIFT);
}
+static inline unsigned long tmh_free_mb(void)
+{
+ return (tmh_avail_pages() + total_free_pages()) >> (20 - PAGE_SHIFT);
+}
+
/*
* Memory allocation for "infrastructure" data
*/