aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/x86_64/mm.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2010-09-01 10:17:49 +0100
committerKeir Fraser <keir.fraser@citrix.com>2010-09-01 10:17:49 +0100
commitbdb5439c3f5d1dbf50a149c6ecb1cbdd1d3b182d (patch)
tree8e214a48419c42663c79a3d1e23acde229ba20de /xen/arch/x86/x86_64/mm.c
parent4e3645c1b018f7a48b1bdfccca04a3b9008af1e9 (diff)
downloadxen-bdb5439c3f5d1dbf50a149c6ecb1cbdd1d3b182d.tar.gz
xen-bdb5439c3f5d1dbf50a149c6ecb1cbdd1d3b182d.tar.bz2
xen-bdb5439c3f5d1dbf50a149c6ecb1cbdd1d3b182d.zip
x86_64: Ensure frame-table compression leaves MAX_ORDER aligned
contiguous ranges of page_info structs. This allows page-pointer arithmetic in places like our buddy allocator. This restriction was already implicitly guaranteed, but it is good to make it explicit in the pdx-related initialisation. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'xen/arch/x86/x86_64/mm.c')
-rw-r--r--xen/arch/x86/x86_64/mm.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index 271cea5ef3..126b2c9421 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -163,9 +163,15 @@ void *do_page_walk(struct vcpu *v, unsigned long addr)
void __init pfn_pdx_hole_setup(unsigned long mask)
{
- unsigned int i, j, bottom_shift, hole_shift;
+ unsigned int i, j, bottom_shift = 0, hole_shift = 0;
- for ( hole_shift = bottom_shift = j = 0; ; )
+ /*
+ * We skip the first MAX_ORDER bits, as we never want to compress them.
+ * This guarantees that page-pointer arithmetic remains valid within
+ * contiguous aligned ranges of 2^MAX_ORDER pages. Among others, our
+ * buddy allocator relies on this assumption.
+ */
+ for ( j = MAX_ORDER-1; ; )
{
i = find_next_zero_bit(&mask, BITS_PER_LONG, j);
j = find_next_bit(&mask, BITS_PER_LONG, i);