From: Bob Liu <lliubbo@gmail.com>
To: xen-devel@lists.xenproject.org
Cc: Bob Liu <bob.liu@oracle.com>,
keir@xen.org, ian.campbell@citrix.com, JBeulich@suse.com
Subject: [PATCH v2 06/11] tmem: cleanup: drop function tmem_alloc/free_infra
Date: Fri, 8 Nov 2013 09:03:52 +0800 [thread overview]
Message-ID: <1383872637-15486-7-git-send-email-bob.liu@oracle.com> (raw)
In-Reply-To: <1383872637-15486-1-git-send-email-bob.liu@oracle.com>
Useless function can be replaced by xmalloc/xfree directly.
Signed-off-by: Bob Liu <bob.liu@oracle.com>
---
xen/common/tmem.c | 11 +++++------
xen/include/xen/tmem_xen.h | 14 --------------
2 files changed, 5 insertions(+), 20 deletions(-)
diff --git a/xen/common/tmem.c b/xen/common/tmem.c
index 3d8e67f..589a515 100644
--- a/xen/common/tmem.c
+++ b/xen/common/tmem.c
@@ -1041,7 +1041,7 @@ static struct tmem_pool * pool_alloc(void)
struct tmem_pool *pool;
int i;
- if ( (pool = tmem_alloc_infra(sizeof(struct tmem_pool),__alignof__(struct tmem_pool))) == NULL )
+ if ( (pool = xmalloc(struct tmem_pool)) == NULL )
return NULL;
for (i = 0; i < OBJ_HASH_BUCKETS; i++)
pool->obj_rb_root[i] = RB_ROOT;
@@ -1070,7 +1070,7 @@ static NOINLINE void pool_free(struct tmem_pool *pool)
INVERT_SENTINEL(pool,POOL);
pool->client = NULL;
list_del(&pool->pool_list);
- tmem_free_infra(pool);
+ xfree(pool);
}
/* register new_client as a user of this shared pool and return new
@@ -1189,7 +1189,7 @@ static void pool_flush(struct tmem_pool *pool, domid_t cli_id, bool_t destroy)
static struct client *client_create(domid_t cli_id)
{
- struct client *client = tmem_alloc_infra(sizeof(struct client),__alignof__(struct client));
+ struct client *client = xzalloc(struct client);
int i;
tmem_client_info("tmem: initializing tmem capability for %s=%d...",
@@ -1199,7 +1199,6 @@ static struct client *client_create(domid_t cli_id)
tmem_client_err("failed... out of memory\n");
goto fail;
}
- memset(client,0,sizeof(struct client));
if ( (client->tmem = tmem_client_init(cli_id)) == NULL )
{
tmem_client_err("failed... can't allocate host-dependent part of client\n");
@@ -1229,7 +1228,7 @@ static struct client *client_create(domid_t cli_id)
return client;
fail:
- tmem_free_infra(client);
+ xfree(client);
return NULL;
}
@@ -1237,7 +1236,7 @@ static void client_free(struct client *client)
{
list_del(&client->client_list);
tmem_client_destroy(client->tmem);
- tmem_free_infra(client);
+ xfree(client);
}
/* flush all data from a client and, optionally, free it */
diff --git a/xen/include/xen/tmem_xen.h b/xen/include/xen/tmem_xen.h
index bbe1eb6..d4eafaf 100644
--- a/xen/include/xen/tmem_xen.h
+++ b/xen/include/xen/tmem_xen.h
@@ -245,20 +245,6 @@ static inline unsigned long tmem_free_mb(void)
return (tmem_page_list_pages + total_free_pages()) >> (20 - PAGE_SHIFT);
}
-/*
- * Memory allocation for "infrastructure" data
- */
-
-static inline void *tmem_alloc_infra(size_t size, size_t align)
-{
- return _xmalloc(size,align);
-}
-
-static inline void tmem_free_infra(void *p)
-{
- return xfree(p);
-}
-
#define tmem_lock_all opt_tmem_lock
#define tmem_called_from_tmem(_memflags) (_memflags & MEMF_tmem)
--
1.7.10.4
next prev parent reply other threads:[~2013-11-08 1:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-08 1:03 [PATCH v2 00/11] tmem: some basic cleanup Bob Liu
2013-11-08 1:03 ` [PATCH v2 01/11] tmem: cleanup: drop COMPARE_COPY_PAGE_SSE2 Bob Liu
2013-11-08 1:03 ` [PATCH v2 02/11] tmem: cleanup: drop typedef pfp_t Bob Liu
2013-11-08 1:03 ` [PATCH v2 03/11] tmem: cleanup: drop typedef tmem_cli_mfn_t Bob Liu
2013-11-08 1:03 ` [PATCH v2 04/11] tmem: cleanup: rename 'tmh_' with 'tmem_' Bob Liu
2013-11-08 1:03 ` [PATCH v2 05/11] tmem: cleanup: drop most of the typedefs Bob Liu
2013-11-08 1:03 ` Bob Liu [this message]
2013-11-08 1:03 ` [PATCH v2 07/11] tmem: cleanup: drop typedef tmem_client_t Bob Liu
2013-11-08 1:03 ` [PATCH v2 08/11] tmem: cleanup: drop useless wrap functions Bob Liu
2013-11-08 1:03 ` [PATCH v2 09/11] tmem: cleanup: drop unused function 'domain_fully_allocated' Bob Liu
2013-11-08 1:03 ` [PATCH v2 10/11] tmem: cleanup: drop useless '_subpage' wrap functions Bob Liu
2013-11-08 1:03 ` [PATCH v2 11/11] tmem: cleanup: drop useless functions Bob Liu
2014-02-07 15:48 ` Konrad Rzeszutek Wilk
2014-02-07 16:16 ` Jan Beulich
2014-02-11 7:45 ` Bob Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1383872637-15486-7-git-send-email-bob.liu@oracle.com \
--to=lliubbo@gmail.com \
--cc=JBeulich@suse.com \
--cc=bob.liu@oracle.com \
--cc=ian.campbell@citrix.com \
--cc=keir@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).