From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH v2 11/11] tmem: cleanup: drop useless functions Date: Fri, 7 Feb 2014 10:48:00 -0500 Message-ID: <20140207154800.GA4855@phenom.dumpdata.com> References: <1383872637-15486-1-git-send-email-bob.liu@oracle.com> <1383872637-15486-12-git-send-email-bob.liu@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WBnez-00064L-Ro for xen-devel@lists.xenproject.org; Fri, 07 Feb 2014 15:48:10 +0000 Content-Disposition: inline In-Reply-To: <1383872637-15486-12-git-send-email-bob.liu@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Bob Liu Cc: xen-devel@lists.xenproject.org, keir@xen.org, ian.campbell@citrix.com, JBeulich@suse.com List-Id: xen-devel@lists.xenproject.org On Fri, Nov 08, 2013 at 09:03:57AM +0800, Bob Liu wrote: > Function tmem_release_avail_pages_to_host() and tmem_scrub_page() only used > once, no need to separate them out. All of the patches look good to me. Let me put them in my tree and do a sanity check tonight and then send a git pull to Jan on Monday. Thank you for making the code much easier to read! > > Signed-off-by: Bob Liu > --- > 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 >