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

[Xen-changelog] [xen-unstable] provide a single, common implementation for get_order_from_{bytes, pages}()



# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1331117431 -3600
# Node ID f611200469159a960c3f0b975aa0f91ec768e29f
# Parent  f234e34ea28f753bba92980f367cf545666d69a1
provide a single, common implementation for get_order_from_{bytes,pages}()

All three per-architecture implementations were identical, and I cannot
see how future architectures would need any sort of customization here
(the only per-architecture aspect here is the actual PAGE_SHIFT value).

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Keir Fraser <keir@xxxxxxx>
---


diff -r f234e34ea28f -r f61120046915 xen/include/asm-arm/mm.h
--- a/xen/include/asm-arm/mm.h  Wed Mar 07 10:59:18 2012 +0100
+++ b/xen/include/asm-arm/mm.h  Wed Mar 07 11:50:31 2012 +0100
@@ -202,25 +202,6 @@
 #define mfn_to_virt(mfn)  (maddr_to_virt((paddr_t)(mfn) << PAGE_SHIFT))
 
 
-static inline int get_order_from_bytes(paddr_t size)
-{
-    int order;
-    size = (size-1) >> PAGE_SHIFT;
-    for ( order = 0; size; order++ )
-        size >>= 1;
-    return order;
-}
-
-static inline int get_order_from_pages(unsigned long nr_pages)
-{
-    int order;
-    nr_pages--;
-    for ( order = 0; nr_pages; order++ )
-        nr_pages >>= 1;
-    return order;
-}
-
-
 /* Convert between Xen-heap virtual addresses and page-info structures. */
 static inline struct page_info *virt_to_page(const void *v)
 {
diff -r f234e34ea28f -r f61120046915 xen/include/asm-ia64/xenpage.h
--- a/xen/include/asm-ia64/xenpage.h    Wed Mar 07 10:59:18 2012 +0100
+++ b/xen/include/asm-ia64/xenpage.h    Wed Mar 07 11:50:31 2012 +0100
@@ -60,24 +60,6 @@
        void *p;
 } xen_va;
 
-static inline int get_order_from_bytes(paddr_t size)
-{
-    int order;
-    size = (size-1) >> PAGE_SHIFT;
-    for ( order = 0; size; order++ )
-        size >>= 1;
-    return order;
-}
-
-static inline int get_order_from_pages(unsigned long nr_pages)
-{
-    int order;
-    nr_pages--;
-    for ( order = 0; nr_pages; order++ )
-        nr_pages >>= 1;
-    return order;
-}
-
 static inline int get_order_from_shift(unsigned long shift)
 {
     if (shift <= PAGE_SHIFT)
diff -r f234e34ea28f -r f61120046915 xen/include/asm-x86/page.h
--- a/xen/include/asm-x86/page.h        Wed Mar 07 10:59:18 2012 +0100
+++ b/xen/include/asm-x86/page.h        Wed Mar 07 11:50:31 2012 +0100
@@ -354,24 +354,6 @@
 
 #ifndef __ASSEMBLY__
 
-static inline int get_order_from_bytes(paddr_t size)
-{
-    int order;
-    size = (size-1) >> PAGE_SHIFT;
-    for ( order = 0; size; order++ )
-        size >>= 1;
-    return order;
-}
-
-static inline int get_order_from_pages(unsigned long nr_pages)
-{
-    int order;
-    nr_pages--;
-    for ( order = 0; nr_pages; order++ )
-        nr_pages >>= 1;
-    return order;
-}
-
 /* Allocator functions for Xen pagetables. */
 void *alloc_xen_pagetable(void);
 void free_xen_pagetable(void *v);
diff -r f234e34ea28f -r f61120046915 xen/include/xen/mm.h
--- a/xen/include/xen/mm.h      Wed Mar 07 10:59:18 2012 +0100
+++ b/xen/include/xen/mm.h      Wed Mar 07 11:50:31 2012 +0100
@@ -318,6 +318,28 @@
 # define page_list_splice(list, hd)        list_splice(list, hd)
 #endif
 
+static inline unsigned int get_order_from_bytes(paddr_t size)
+{
+    unsigned int order;
+
+    size = (size - 1) >> PAGE_SHIFT;
+    for ( order = 0; size; order++ )
+        size >>= 1;
+
+    return order;
+}
+
+static inline unsigned int get_order_from_pages(unsigned long nr_pages)
+{
+    unsigned int order;
+
+    nr_pages--;
+    for ( order = 0; nr_pages; order++ )
+        nr_pages >>= 1;
+
+    return order;
+}
+
 void scrub_one_page(struct page_info *);
 
 /* Returns 1 on success, 0 on error, negative if the ring

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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