xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
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 08/11] tmem: cleanup: drop useless wrap functions
Date: Mon,  4 Nov 2013 20:40:51 +0800	[thread overview]
Message-ID: <1383568854-30521-9-git-send-email-bob.liu@oracle.com> (raw)
In-Reply-To: <1383568854-30521-1-git-send-email-bob.liu@oracle.com>

_tmem_alloc/free_subpage_thispool() and _tmem_alloc/free_page_thispool() are
useless, replace them with tmem_alloc/free_subpage_thispool() and
tmem_alloc/free_page_thispool() directly.

Signed-off-by: Bob Liu <bob.liu@oracle.com>
---
 xen/common/tmem.c          |    8 ++++----
 xen/common/tmem_xen.c      |    8 ++++----
 xen/include/xen/tmem_xen.h |   20 ++++++--------------
 3 files changed, 14 insertions(+), 22 deletions(-)

diff --git a/xen/common/tmem.c b/xen/common/tmem.c
index 4ff4824..234e49a 100644
--- a/xen/common/tmem.c
+++ b/xen/common/tmem.c
@@ -311,7 +311,7 @@ static NOINLINE void *_tmem_malloc(size_t size, size_t align, struct tmem_pool *
     void *v;
 
     if ( (pool != NULL) && is_persistent(pool) )
-        v = tmem_alloc_subpage_thispool(pool,size,align);
+        v = tmem_alloc_subpage_thispool(pool->client->persistent_pool,size,align);
     else
         v = tmem_alloc_subpage(pool, size, align);
     if ( v == NULL )
@@ -324,7 +324,7 @@ static NOINLINE void tmem_free(void *p, size_t size, struct tmem_pool *pool)
     if ( pool == NULL || !is_persistent(pool) )
         tmem_free_subpage(p,size);
     else
-        tmem_free_subpage_thispool(pool,p,size);
+        tmem_free_subpage_thispool(pool->client->persistent_pool,p,size);
 }
 
 static NOINLINE struct page_info *tmem_page_alloc(struct tmem_pool *pool)
@@ -332,7 +332,7 @@ static NOINLINE struct page_info *tmem_page_alloc(struct tmem_pool *pool)
     struct page_info *pfp = NULL;
 
     if ( pool != NULL && is_persistent(pool) )
-        pfp = tmem_alloc_page_thispool(pool);
+        pfp = tmem_alloc_page_thispool(pool->client->domain);
     else
         pfp = tmem_alloc_page(pool,0);
     if ( pfp == NULL )
@@ -348,7 +348,7 @@ static NOINLINE void tmem_page_free(struct tmem_pool *pool, struct page_info *pf
     if ( pool == NULL || !is_persistent(pool) )
         tmem_free_page(pfp);
     else
-        tmem_free_page_thispool(pool,pfp);
+        tmem_free_page_thispool(pfp);
     atomic_dec_and_assert(global_page_count);
 }
 
diff --git a/xen/common/tmem_xen.c b/xen/common/tmem_xen.c
index be08c3d..0f5955d 100644
--- a/xen/common/tmem_xen.c
+++ b/xen/common/tmem_xen.c
@@ -341,26 +341,26 @@ static int __init tmem_mempool_init(void)
 
 /* persistent pools are per-domain */
 
-static void *tmem_persistent_pool_page_get(unsigned long size)
+void *tmem_persistent_pool_page_get(unsigned long size)
 {
     struct page_info *pi;
     struct domain *d = current->domain;
 
     ASSERT(size == PAGE_SIZE);
-    if ( (pi = _tmem_alloc_page_thispool(d)) == NULL )
+    if ( (pi = tmem_alloc_page_thispool(d)) == NULL )
         return NULL;
     ASSERT(IS_VALID_PAGE(pi));
     return page_to_virt(pi);
 }
 
-static void tmem_persistent_pool_page_put(void *page_va)
+void tmem_persistent_pool_page_put(void *page_va)
 {
     struct page_info *pi;
 
     ASSERT(IS_PAGE_ALIGNED(page_va));
     pi = mfn_to_page(virt_to_mfn(page_va));
     ASSERT(IS_VALID_PAGE(pi));
-    _tmem_free_page_thispool(pi);
+    tmem_free_page_thispool(pi);
 }
 
 /******************  XEN-SPECIFIC HOST INITIALIZATION ********************/
diff --git a/xen/include/xen/tmem_xen.h b/xen/include/xen/tmem_xen.h
index 61a22ca..e2c03d2 100644
--- a/xen/include/xen/tmem_xen.h
+++ b/xen/include/xen/tmem_xen.h
@@ -118,7 +118,7 @@ static inline bool_t domain_fully_allocated(struct domain *d)
 #define tmem_client_memory_fully_allocated(_pool) \
  domain_fully_allocated(_pool->client->domain)
 
-static inline void *_tmem_alloc_subpage_thispool(struct xmem_pool *cmem_mempool,
+static inline void *tmem_alloc_subpage_thispool(struct xmem_pool *cmem_mempool,
                                                  size_t size, size_t align)
 {
 #if 0
@@ -130,21 +130,16 @@ static inline void *_tmem_alloc_subpage_thispool(struct xmem_pool *cmem_mempool,
         return NULL;
     return xmem_pool_alloc(size, cmem_mempool);
 }
-#define tmem_alloc_subpage_thispool(_pool, _s, _a) \
-            _tmem_alloc_subpage_thispool(pool->client->persistent_pool, \
-                                         _s, _a)
 
-static inline void _tmem_free_subpage_thispool(struct xmem_pool *cmem_mempool,
+static inline void tmem_free_subpage_thispool(struct xmem_pool *cmem_mempool,
                                                void *ptr, size_t size)
 {
     ASSERT( size < tmem_mempool_maxalloc );
     ASSERT( cmem_mempool != NULL );
     xmem_pool_free(ptr,cmem_mempool);
 }
-#define tmem_free_subpage_thispool(_pool, _p, _s) \
- _tmem_free_subpage_thispool(_pool->client->persistent_pool, _p, _s)
 
-static inline struct page_info *_tmem_alloc_page_thispool(struct domain *d)
+static inline struct page_info *tmem_alloc_page_thispool(struct domain *d)
 {
     struct page_info *pi;
 
@@ -171,10 +166,8 @@ out:
     ASSERT((pi == NULL) || IS_VALID_PAGE(pi));
     return pi;
 }
-#define tmem_alloc_page_thispool(_pool) \
-    _tmem_alloc_page_thispool(_pool->client->domain)
 
-static inline void _tmem_free_page_thispool(struct page_info *pi)
+static inline void tmem_free_page_thispool(struct page_info *pi)
 {
     struct domain *d = page_get_owner(pi);
 
@@ -188,8 +181,6 @@ static inline void _tmem_free_page_thispool(struct page_info *pi)
         free_domheap_pages(pi,0);
     }
 }
-#define tmem_free_page_thispool(_pool,_pg) \
-    _tmem_free_page_thispool(_pg)
 
 /*
  * Memory allocation for ephemeral (non-persistent) data
@@ -448,7 +439,8 @@ int tmem_copy_to_client(xen_pfn_t, struct page_info *, pagesize_t tmem_offset,
     pagesize_t pfn_offset, pagesize_t len, tmem_cli_va_param_t);
 
 extern int tmem_copy_tze_to_client(xen_pfn_t cmfn, void *tmem_va, pagesize_t len);
-
+extern void *tmem_persistent_pool_page_get(unsigned long size);
+extern void tmem_persistent_pool_page_put(void *page_va);
 #define tmem_client_err(fmt, args...)  printk(XENLOG_G_ERR fmt, ##args)
 #define tmem_client_warn(fmt, args...) printk(XENLOG_G_WARNING fmt, ##args)
 #define tmem_client_info(fmt, args...) printk(XENLOG_G_INFO fmt, ##args)
-- 
1.7.10.4

  parent reply	other threads:[~2013-11-04 12:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-04 12:40 [RFC PATCH 00/11] tmem: some basic cleanup Bob Liu
2013-11-04 12:40 ` [PATCH 01/11] tmem: cleanup: drop COMPARE_COPY_PAGE_SSE2 Bob Liu
2013-11-04 12:40 ` [PATCH 02/11] tmem: cleanup: drop typedef pfp_t Bob Liu
2013-11-04 12:40 ` [PATCH 03/11] tmem: cleanup: drop typedef tmem_cli_mfn_t Bob Liu
2013-11-04 12:40 ` [PATCH 04/11] tmem: cleanup: rename 'tmh_' with 'tmem_' Bob Liu
2013-11-04 12:40 ` [PATCH 05/11] tmem: cleanup: drop most of the typedefs Bob Liu
2013-11-04 12:40 ` [PATCH 06/11] tmem: cleanup: drop function tmem_alloc/free_infra Bob Liu
2013-11-04 12:40 ` [PATCH 07/11] tmem: cleanup: drop typedef tmem_client_t Bob Liu
2013-11-04 12:40 ` Bob Liu [this message]
2013-11-04 12:40 ` [PATCH 09/11] tmem: cleanup: drop unused function 'domain_fully_allocated' Bob Liu
2013-11-04 12:40 ` [PATCH 10/11] tmem: cleanup: drop useless '_subpage' wrap functions Bob Liu
2013-11-04 12:40 ` [PATCH 11/11] tmem: cleanup: drop useless functions Bob Liu
2013-11-04 15:56 ` [RFC PATCH 00/11] tmem: some basic cleanup Jan Beulich
2013-11-04 16:48   ` Konrad Rzeszutek Wilk
2013-11-05  2:04   ` Bob Liu
2013-11-05  9:03     ` Jan Beulich
2013-11-05 14:46       ` Konrad Rzeszutek Wilk
2013-11-05 14:57         ` Jan Beulich

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=1383568854-30521-9-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).