[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 11/11] tmem: cleanup: drop useless functions



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 <bob.liu@xxxxxxxxxx>
> ---
>  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
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.