[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 <yamah...@valinux.co.jp>

diff --git a/xen/arch/ia64/xen/domain.c b/xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c
+++ b/xen/arch/ia64/xen/domain.c
@@ -407,12 +407,29 @@ void relinquish_vcpu_resources(struct vc
 
 struct domain *alloc_domain_struct(void)
 {
-    return xmalloc(struct domain);
+#ifdef CONFIG_IA64_PICKLE_DOMAIN
+       struct domain *d;
+       /*
+        * We pack the MFN of the domain structure into a 32-bit field within
+        * the page_info structure. Hence the MEMF_bits() restriction.
+        */
+       d = alloc_xenheap_pages(get_order_from_bytes(sizeof(*d)),
+                               MEMF_bits(32 + PAGE_SHIFT));
+       if ( d != NULL )
+               memset(d, 0, sizeof(*d));
+       return d;
+#else
+       return xmalloc(struct domain);
+#endif
 }
 
 void free_domain_struct(struct domain *d)
 {
-    xfree(d);
+#ifdef CONFIG_IA64_PICKLE_DOMAIN
+       free_xenheap_pages(d, get_order_from_bytes(sizeof(*d)));
+#else
+       xfree(d);
+#endif
 }
 
 struct vcpu *alloc_vcpu_struct(void)
diff --git a/xen/include/asm-ia64/config.h b/xen/include/asm-ia64/config.h
--- a/xen/include/asm-ia64/config.h
+++ b/xen/include/asm-ia64/config.h
@@ -1,6 +1,13 @@
 #ifndef        _IA64_CONFIG_H_
 #define _IA64_CONFIG_H_
 
+/*
+ * If they are deifned,
+ * shrink struct page_info assuming all mfn can be addressed by 32 bits
+ */
+#undef CONFIG_IA64_SHRINK_PAGE_LIST
+#undef CONFIG_IA64_PICKLE_DOMAIN
+
 #undef DEBUG_PFMON
 
 // manufactured from component pieces
diff --git a/xen/include/asm-ia64/mm.h b/xen/include/asm-ia64/mm.h
--- a/xen/include/asm-ia64/mm.h
+++ b/xen/include/asm-ia64/mm.h
@@ -39,19 +39,26 @@ typedef unsigned long page_flags_t;
 
 #define PRtype_info "016lx"
 
-#if 0
+#ifdef CONFIG_IA64_SHRINK_PAGE_LIST
 /*
  * See include/xen/mm.h.
- * For now, abandon to compress struct page_info
- * seeing IA64_MAX_PHYS_BITS and page size.
+ * To compress page_list_entry, all the physical address must
+ * be addressed by (32 + PAGE_SHIFT) .
+ * However this is lower than IA64_MAX_PHYS_BITS = 50.
  */
 #undef page_list_entry
 struct page_list_entry
 {
-    unsigned long next, prev;
+    u32 next, prev;
 };
 #endif
 
+#ifdef CONFIG_IA64_PICKLE_DOMAIN
+typedef u32 __ia64_domain_t;
+#else
+typedef unsigned long __ia64_domain_t;
+#endif
+
 struct page_info
 {
     /* Each frame can be threaded onto a doubly-linked list. */
@@ -65,31 +72,24 @@ struct page_info
 
         /* Page is in use: ((count_info & PGC_count_mask) != 0). */
         struct {
-            /* Owner of this page (NULL if page is anonymous). */
-            unsigned long _domain; /* pickled format */
             /* Type reference count and various PGT_xxx flags and fields. */
             unsigned long type_info;
+            /* Owner of this page (NULL if page is anonymous). */
+            __ia64_domain_t _domain; /* pickled format */
         } inuse;
 
         /* Page is on a free list: ((count_info & PGC_count_mask) == 0). */
         struct {
+            /* Mask of possibly-tainted TLBs. */
+            cpumask_t cpumask;
             /* Order-size of the free chunk this page is the head of. */
             u32 order;
-            /* Mask of possibly-tainted TLBs. */
-            cpumask_t cpumask;
         } free;
 
     } u;
 
     /* Timestamp from 'TLB clock', used to reduce need for safety flushes. */
     u32 tlbflush_timestamp;
-
-#if 0
-// following added for Linux compiling
-    page_flags_t flags;
-    atomic_t _count;
-    struct list_head lru;      // is this the same as above "list"?
-#endif
 };
 
 #define set_page_count(p,v)    atomic_set(&(p)->_count, v - 1)
@@ -139,8 +139,16 @@ struct page_info
 #define is_xen_heap_mfn(mfn)    (mfn_valid(mfn) &&                      \
                                  is_xen_heap_page(mfn_to_page(mfn)))
 
+#ifdef CONFIG_IA64_PICKLE_DOMAIN
+#define page_get_owner(_p)                                              \
+    ((struct domain *)((_p)->v.inuse._domain ?                          \
+                       mfn_to_virt((_p)->v.inuse._domain) : NULL))
+#define page_set_owner(_p,_d)                                           \
+    ((_p)->v.inuse._domain = (_d) ? virt_to_mfn(_d) : 0)
+#else
 #define page_get_owner(_p)      ((struct domain *)(_p)->u.inuse._domain)
 #define page_set_owner(_p, _d) ((_p)->u.inuse._domain = (unsigned long)(_d))
+#endif
 
 #define XENSHARE_writable 0
 #define XENSHARE_readonly 1


-- 
yamahata

_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@lists.xensource.com
http://lists.xensource.com/xen-ia64-devel

Reply via email to