ia64/xen-unstable

changeset 19203:726b56720b16

[IA64] shrink ia64 struct page_info.

This patch is the ia64 counter part of 19107:0858f961c77a,
19132:5848b49b74fc and 19136:162cdb596b9a.
This patch shrink ia64 struct page_info and rearrange its members.

The shrinking is made compile time option in config.h with default off
becuase physical address size is architected to 50bit by ia64
and mfn isn't always addressed by 32bits with 16KB page size.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Isaku Yamahata <yamahata@valinux.co.jp>
date Fri Feb 13 11:23:16 2009 +0900 (2009-02-13)
parents af0da711bbdb
children 9b761ae54610 e6f1c66874d5
files xen/arch/ia64/Rules.mk xen/arch/ia64/xen/domain.c xen/include/asm-ia64/mm.h
line diff
     1.1 --- a/xen/arch/ia64/Rules.mk	Fri Feb 13 11:22:59 2009 +0900
     1.2 +++ b/xen/arch/ia64/Rules.mk	Fri Feb 13 11:23:16 2009 +0900
     1.3 @@ -16,6 +16,13 @@ xen_ia64_tlb_track_cnt	?= n
     1.4  xen_ia64_tlbflush_clock	?= y
     1.5  xen_ia64_disable_optvfault ?= n
     1.6  
     1.7 +# If they are enabled,
     1.8 +# shrink struct page_info assuming all mfn can be addressed by 32 bits.
     1.9 +# However, with 50bit ia64 architected physical address and 16KB page size,
    1.10 +# mfn isn't always assessed by 32bit. So they are disabled by default.
    1.11 +xen_ia64_shrink_page_list ?= n
    1.12 +xen_ia64_pickle_domain ?= n
    1.13 +
    1.14  # Used only by linux/Makefile.
    1.15  AFLAGS_KERNEL  += -mconstant-gp -nostdinc $(CPPFLAGS)
    1.16  
    1.17 @@ -71,5 +78,11 @@ endif
    1.18  ifeq ($(xen_ia64_disable_optvfault),y)
    1.19  CFLAGS += -DCONFIG_XEN_IA64_DISABLE_OPTVFAULT
    1.20  endif
    1.21 +ifeq ($(xen_ia64_shrink_page_list),y)
    1.22 +CFLAGS += -DCONFIG_IA64_SHRINK_PAGE_LIST
    1.23 +endif
    1.24 +ifeq ($(xen_ia64_pickle_domain),y)
    1.25 +CFLAGS += -DCONFIG_IA64_PICKLE_DOMAIN
    1.26 +endif
    1.27  
    1.28  LDFLAGS = -g
     2.1 --- a/xen/arch/ia64/xen/domain.c	Fri Feb 13 11:22:59 2009 +0900
     2.2 +++ b/xen/arch/ia64/xen/domain.c	Fri Feb 13 11:23:16 2009 +0900
     2.3 @@ -407,12 +407,29 @@ void relinquish_vcpu_resources(struct vc
     2.4  
     2.5  struct domain *alloc_domain_struct(void)
     2.6  {
     2.7 -    return xmalloc(struct domain);
     2.8 +#ifdef CONFIG_IA64_PICKLE_DOMAIN
     2.9 +	struct domain *d;
    2.10 +	/*
    2.11 +	 * We pack the MFN of the domain structure into a 32-bit field within
    2.12 +	 * the page_info structure. Hence the MEMF_bits() restriction.
    2.13 +	 */
    2.14 +	d = alloc_xenheap_pages(get_order_from_bytes(sizeof(*d)),
    2.15 +				MEMF_bits(32 + PAGE_SHIFT));
    2.16 +	if ( d != NULL )
    2.17 +		memset(d, 0, sizeof(*d));
    2.18 +	return d;
    2.19 +#else
    2.20 +	return xmalloc(struct domain);
    2.21 +#endif
    2.22  }
    2.23  
    2.24  void free_domain_struct(struct domain *d)
    2.25  {
    2.26 -    xfree(d);
    2.27 +#ifdef CONFIG_IA64_PICKLE_DOMAIN
    2.28 +	free_xenheap_pages(d, get_order_from_bytes(sizeof(*d)));
    2.29 +#else
    2.30 +	xfree(d);
    2.31 +#endif
    2.32  }
    2.33  
    2.34  struct vcpu *alloc_vcpu_struct(void)
     3.1 --- a/xen/include/asm-ia64/mm.h	Fri Feb 13 11:22:59 2009 +0900
     3.2 +++ b/xen/include/asm-ia64/mm.h	Fri Feb 13 11:23:16 2009 +0900
     3.3 @@ -39,19 +39,26 @@ typedef unsigned long page_flags_t;
     3.4  
     3.5  #define PRtype_info "016lx"
     3.6  
     3.7 -#if 0
     3.8 +#ifdef CONFIG_IA64_SHRINK_PAGE_LIST
     3.9  /*
    3.10   * See include/xen/mm.h.
    3.11 - * For now, abandon to compress struct page_info
    3.12 - * seeing IA64_MAX_PHYS_BITS and page size.
    3.13 + * To compress page_list_entry, all the physical address must
    3.14 + * be addressed by (32 + PAGE_SHIFT) .
    3.15 + * However this is lower than IA64_MAX_PHYS_BITS = 50.
    3.16   */
    3.17  #undef page_list_entry
    3.18  struct page_list_entry
    3.19  {
    3.20 -    unsigned long next, prev;
    3.21 +    u32 next, prev;
    3.22  };
    3.23  #endif
    3.24  
    3.25 +#ifdef CONFIG_IA64_PICKLE_DOMAIN
    3.26 +typedef u32 __ia64_domain_t;
    3.27 +#else
    3.28 +typedef unsigned long __ia64_domain_t;
    3.29 +#endif
    3.30 +
    3.31  struct page_info
    3.32  {
    3.33      /* Each frame can be threaded onto a doubly-linked list. */
    3.34 @@ -65,10 +72,10 @@ struct page_info
    3.35  
    3.36          /* Page is in use: ((count_info & PGC_count_mask) != 0). */
    3.37          struct {
    3.38 -            /* Owner of this page (NULL if page is anonymous). */
    3.39 -            unsigned long _domain; /* pickled format */
    3.40              /* Type reference count and various PGT_xxx flags and fields. */
    3.41              unsigned long type_info;
    3.42 +            /* Owner of this page (NULL if page is anonymous). */
    3.43 +            __ia64_domain_t _domain; /* pickled format */
    3.44          } inuse;
    3.45  
    3.46          /* Page is on a free list: ((count_info & PGC_count_mask) == 0). */
    3.47 @@ -132,8 +139,16 @@ struct page_info
    3.48  #define is_xen_heap_mfn(mfn)    (mfn_valid(mfn) &&                      \
    3.49                                   is_xen_heap_page(mfn_to_page(mfn)))
    3.50  
    3.51 +#ifdef CONFIG_IA64_PICKLE_DOMAIN
    3.52 +#define page_get_owner(_p)                                              \
    3.53 +    ((struct domain *)((_p)->v.inuse._domain ?                          \
    3.54 +                       mfn_to_virt((_p)->v.inuse._domain) : NULL))
    3.55 +#define page_set_owner(_p,_d)                                           \
    3.56 +    ((_p)->v.inuse._domain = (_d) ? virt_to_mfn(_d) : 0)
    3.57 +#else
    3.58  #define page_get_owner(_p)      ((struct domain *)(_p)->u.inuse._domain)
    3.59  #define page_set_owner(_p, _d)	((_p)->u.inuse._domain = (unsigned long)(_d))
    3.60 +#endif
    3.61  
    3.62  #define XENSHARE_writable 0
    3.63  #define XENSHARE_readonly 1