diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2009-08-10 13:27:54 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2009-08-10 13:27:54 +0100 |
commit | 81d70f1a53806178596e48a8f81f870a5f9c74e0 (patch) | |
tree | 52943c0142ba3cb9eafc2362a6d9aaf3a1adb0c1 /xen/common/tmem.c | |
parent | 37541c41651ee9b29ffeda3870cb3ba704d7e756 (diff) | |
download | xen-81d70f1a53806178596e48a8f81f870a5f9c74e0.tar.gz xen-81d70f1a53806178596e48a8f81f870a5f9c74e0.tar.bz2 xen-81d70f1a53806178596e48a8f81f870a5f9c74e0.zip |
tmem: expose freeable memory
Expose tmem "freeable" memory for use by management tools.
Management tools looking for a machine with available
memory often look at free_memory to determine if there
is enough physical memory to house a new or migrating
guest. Since tmem absorbs much or all free memory,
and since "ephemeral" tmem memory can be synchronously
freed, management tools need more data -- not only how
much memory is "free" but also how much memory is
"freeable" by tmem if tmem is told (via an already
existing tmem hypercall) to relinquish freeable memory.
This patch provides that extra piece of data (in MB).
Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Diffstat (limited to 'xen/common/tmem.c')
-rw-r--r-- | xen/common/tmem.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/xen/common/tmem.c b/xen/common/tmem.c index 9df8d4d91e..55c2aabdad 100644 --- a/xen/common/tmem.c +++ b/xen/common/tmem.c @@ -752,7 +752,7 @@ static pool_t * pool_alloc(void) pool_t *pool; int i; - if ( (pool = tmem_malloc(pool_t,NULL)) == NULL ) + if ( (pool = tmh_alloc_infra(sizeof(pool_t),__alignof__(pool_t))) == NULL ) return NULL; for (i = 0; i < OBJ_HASH_BUCKETS; i++) pool->obj_rb_root[i] = RB_ROOT; @@ -780,7 +780,7 @@ static NOINLINE void pool_free(pool_t *pool) INVERT_SENTINEL(pool,POOL); pool->client = NULL; list_del(&pool->pool_list); - tmem_free(pool,sizeof(pool_t),NULL); + tmh_free_infra(pool); } /* register new_client as a user of this shared pool and return new @@ -898,7 +898,7 @@ static void pool_flush(pool_t *pool, cli_id_t cli_id, bool_t destroy) static client_t *client_create(cli_id_t cli_id) { - client_t *client = tmem_malloc(client_t,NULL); + client_t *client = tmh_alloc_infra(sizeof(client_t),__alignof__(client_t)); int i; printk("tmem: initializing tmem capability for %s=%d...",cli_id_str,cli_id); @@ -912,7 +912,7 @@ static client_t *client_create(cli_id_t cli_id) { printk("failed... can't allocate host-dependent part of client\n"); if ( client ) - tmem_free(client,sizeof(client_t),NULL); + tmh_free_infra(client); return NULL; } tmh_set_client_from_id(client,cli_id); @@ -2150,6 +2150,9 @@ static NOINLINE int do_tmem_control(struct tmem_op *op) case TMEMC_SET_COMPRESS: ret = tmemc_set_var(op->u.ctrl.cli_id,subop,op->u.ctrl.arg1); break; + case TMEMC_QUERY_FREEABLE_MB: + ret = tmh_freeable_mb(); + break; case TMEMC_SAVE_BEGIN: case TMEMC_RESTORE_BEGIN: case TMEMC_SAVE_GET_VERSION: |