ia64/xen-unstable

changeset 19796:1c01814f9a25

Introduce page_list_move()

This not only allows to remove ia64's special implementation of
page_list_splice_init(), but also fixes the latent issue with the
direct list head assignment in the x86 code if that would ever get
switched back to using normal list entries for linking together pages
(i.e. whenever x86-64 is to support more tha 16Tb of memory).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jun 18 10:30:28 2009 +0100 (2009-06-18)
parents 4f779d41b0ba
children 8440fc9f7a25
files xen/arch/ia64/xen/domain.c xen/arch/x86/domain.c xen/include/asm-ia64/mm.h xen/include/xen/mm.h
line diff
     1.1 --- a/xen/arch/ia64/xen/domain.c	Thu Jun 18 10:29:58 2009 +0100
     1.2 +++ b/xen/arch/ia64/xen/domain.c	Thu Jun 18 10:30:28 2009 +0100
     1.3 @@ -1705,7 +1705,7 @@ static int relinquish_memory(struct doma
     1.4          }
     1.5      }
     1.6  
     1.7 -    page_list_splice_init(&d->arch.relmem_list, list);
     1.8 +    page_list_move(list, &d->arch.relmem_list);
     1.9  
    1.10   out:
    1.11      spin_unlock_recursive(&d->page_alloc_lock);
     2.1 --- a/xen/arch/x86/domain.c	Thu Jun 18 10:29:58 2009 +0100
     2.2 +++ b/xen/arch/x86/domain.c	Thu Jun 18 10:30:28 2009 +0100
     2.3 @@ -1818,11 +1818,7 @@ static int relinquish_memory(
     2.4      }
     2.5  
     2.6      /* list is empty at this point. */
     2.7 -    if ( !page_list_empty(&d->arch.relmem_list) )
     2.8 -    {
     2.9 -        *list = d->arch.relmem_list;
    2.10 -        INIT_PAGE_LIST_HEAD(&d->arch.relmem_list);
    2.11 -    }
    2.12 +    page_list_move(list, &d->arch.relmem_list);
    2.13  
    2.14   out:
    2.15      spin_unlock_recursive(&d->page_alloc_lock);
     3.1 --- a/xen/include/asm-ia64/mm.h	Thu Jun 18 10:29:58 2009 +0100
     3.2 +++ b/xen/include/asm-ia64/mm.h	Thu Jun 18 10:30:28 2009 +0100
     3.3 @@ -92,24 +92,6 @@ struct page_info
     3.4      u32 tlbflush_timestamp;
     3.5  };
     3.6  
     3.7 -#ifndef page_list_entry
     3.8 -static inline void
     3.9 -page_list_splice_init(struct page_list_head *list, struct page_list_head *head)
    3.10 -{
    3.11 -    if ( !page_list_empty(list) )
    3.12 -    {
    3.13 -        if ( head->next )
    3.14 -            head->tail->list.next = page_to_mfn(list->next);
    3.15 -        else
    3.16 -            head->next = list->next;
    3.17 -        head->tail = list->tail;
    3.18 -        INIT_PAGE_LIST_HEAD(list);
    3.19 -    }
    3.20 -}
    3.21 -#else
    3.22 -# define page_list_splice_init	list_splice_init
    3.23 -#endif
    3.24 -
    3.25  #define set_page_count(p,v) 	atomic_set(&(p)->_count, v - 1)
    3.26  
    3.27  /*
     4.1 --- a/xen/include/xen/mm.h	Thu Jun 18 10:29:58 2009 +0100
     4.2 +++ b/xen/include/xen/mm.h	Thu Jun 18 10:30:28 2009 +0100
     4.3 @@ -223,7 +223,15 @@ page_list_remove_head(struct page_list_h
     4.4  
     4.5      return page;
     4.6  }
     4.7 -
     4.8 +static inline void
     4.9 +page_list_move(struct page_list_head *dst, struct page_list_head *src)
    4.10 +{
    4.11 +    if ( !page_list_empty(src) )
    4.12 +    {
    4.13 +        *dst = *src;
    4.14 +        INIT_PAGE_LIST_HEAD(src);
    4.15 +    }
    4.16 +}
    4.17  static inline void
    4.18  page_list_splice(struct page_list_head *list, struct page_list_head *head)
    4.19  {
    4.20 @@ -281,6 +289,8 @@ page_list_splice(struct page_list_head *
    4.21          list_del(&__pg->list); \
    4.22          __pg; \
    4.23      }) : NULL)
    4.24 +# define page_list_move(dst, src)        (!list_empty(src) ? \
    4.25 +    list_replace_init(src, dst) : (void)0)
    4.26  # define page_list_for_each(pos, head)   list_for_each_entry(pos, head, list)
    4.27  # define page_list_for_each_safe(pos, tmp, head) \
    4.28      list_for_each_entry_safe(pos, tmp, head, list)