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 v2 11/11] tmem: cleanup: drop useless functions
Date: Fri,  8 Nov 2013 09:03:57 +0800	[thread overview]
Message-ID: <1383872637-15486-12-git-send-email-bob.liu@oracle.com> (raw)
In-Reply-To: <1383872637-15486-1-git-send-email-bob.liu@oracle.com>

Function tmem_release_avail_pages_to_host() and tmem_scrub_page() only used
once, no need to separate them out.

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

diff --git a/xen/common/tmem.c b/xen/common/tmem.c
index f009fd8..3d15ead 100644
--- a/xen/common/tmem.c
+++ b/xen/common/tmem.c
@@ -1418,7 +1418,19 @@ static unsigned long tmem_relinquish_npages(unsigned long n)
             break;
     }
     if ( avail_pages )
-        tmem_release_avail_pages_to_host();
+    {
+        spin_lock(&tmem_page_list_lock);
+        while ( !page_list_empty(&tmem_page_list) )
+        {
+            struct page_info *pg = page_list_remove_head(&tmem_page_list);
+            scrub_one_page(pg);
+            tmem_page_list_pages--;
+            free_domheap_page(pg);
+        }
+        ASSERT(tmem_page_list_pages == 0);
+        INIT_PAGE_LIST_HEAD(&tmem_page_list);
+        spin_unlock(&tmem_page_list_lock);
+    }
     return avail_pages;
 }
 
@@ -2911,9 +2923,12 @@ EXPORT void *tmem_relinquish_pages(unsigned int order, unsigned int memflags)
     }
     if ( evicts_per_relinq > max_evicts_per_relinq )
         max_evicts_per_relinq = evicts_per_relinq;
-    tmem_scrub_page(pfp, memflags);
     if ( pfp != NULL )
+    {
+        if ( !(memflags & MEMF_tmem) )
+            scrub_one_page(pfp);
         relinq_pgs++;
+    }
 
     if ( tmem_called_from_tmem(memflags) )
     {
diff --git a/xen/common/tmem_xen.c b/xen/common/tmem_xen.c
index 0f5955d..d6e2e0d 100644
--- a/xen/common/tmem_xen.c
+++ b/xen/common/tmem_xen.c
@@ -289,30 +289,6 @@ EXPORT DEFINE_SPINLOCK(tmem_page_list_lock);
 EXPORT PAGE_LIST_HEAD(tmem_page_list);
 EXPORT unsigned long tmem_page_list_pages = 0;
 
-/* free anything on tmem_page_list to Xen's scrub list */
-EXPORT void tmem_release_avail_pages_to_host(void)
-{
-    spin_lock(&tmem_page_list_lock);
-    while ( !page_list_empty(&tmem_page_list) )
-    {
-        struct page_info *pg = page_list_remove_head(&tmem_page_list);
-        scrub_one_page(pg);
-        tmem_page_list_pages--;
-        free_domheap_page(pg);
-    }
-    ASSERT(tmem_page_list_pages == 0);
-    INIT_PAGE_LIST_HEAD(&tmem_page_list);
-    spin_unlock(&tmem_page_list_lock);
-}
-
-EXPORT void tmem_scrub_page(struct page_info *pi, unsigned int memflags)
-{
-    if ( pi == NULL )
-        return;
-    if ( !(memflags & MEMF_tmem) )
-        scrub_one_page(pi);
-}
-
 static noinline void *tmem_mempool_page_get(unsigned long size)
 {
     struct page_info *pi;
diff --git a/xen/include/xen/tmem_xen.h b/xen/include/xen/tmem_xen.h
index f9639a5..034fd5c 100644
--- a/xen/include/xen/tmem_xen.h
+++ b/xen/include/xen/tmem_xen.h
@@ -42,9 +42,6 @@ extern void tmem_copy_page(char *to, char*from);
 extern int tmem_init(void);
 #define tmem_hash hash_long
 
-extern void tmem_release_avail_pages_to_host(void);
-extern void tmem_scrub_page(struct page_info *pi, unsigned int memflags);
-
 extern bool_t opt_tmem_compress;
 static inline bool_t tmem_compression_enabled(void)
 {
-- 
1.7.10.4

  parent reply	other threads:[~2013-11-08  1:06 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 ` [PATCH v2 06/11] tmem: cleanup: drop function tmem_alloc/free_infra Bob Liu
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 ` Bob Liu [this message]
2014-02-07 15:48   ` [PATCH v2 11/11] tmem: cleanup: drop useless functions 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-12-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).