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@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
This commit is contained in:
Jan Beulich committed 2012-03-07 11:50:31 +01:00
1 parent e45066d3c3
commit 5fb0f4f5d8
4 files changed
+22 -55

No files matched your search

-19
View File
@@ -202,25 +202,6 @@ static inline paddr_t gvirt_to_maddr(uint32_t va)
#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)
{
-18
View File
@@ -60,24 +60,6 @@ typedef union xen_va {
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)
-18
View File
@@ -354,24 +354,6 @@ void setup_idle_pagetable(void);
#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);
+22
View File
@@ -318,6 +318,28 @@ page_list_splice(struct page_list_head *list, struct page_list_head *head)
# 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
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.