On 24.02.2012, at 01:23, David Gibson wrote: > From: Benjamin Herrenschmidt <b...@kernel.crashing.org> > > If the kernel page size is larger than TARGET_PAGE_SIZE, which > happens for example on ppc64 with kernels compiled for 64K pages, > the dirty tracking doesn't work. > > Cc: Avi Kivity <a...@redhat.com> > Cc: Marcelo Tossatti <mtossa...@redhat.com> > > Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> > Signed-off-by: David Gibson <da...@gibson.dropbear.id.au> > --- > kvm-all.c | 7 ++++--- > 1 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/kvm-all.c b/kvm-all.c > index 5e188bf..3f8cfd9 100644 > --- a/kvm-all.c > +++ b/kvm-all.c > @@ -348,10 +348,11 @@ static int kvm_set_migration_log(int enable) > static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section, > unsigned long *bitmap) > { > - unsigned int i, j; > + unsigned int i, j; > unsigned long page_number, c; > target_phys_addr_t addr, addr1; > unsigned int len = ((section->size / TARGET_PAGE_SIZE) + HOST_LONG_BITS - > 1) / HOST_LONG_BITS; > + unsigned long hpratio = getpagesize() / TARGET_PAGE_SIZE;
Actually, looking at this, don't we rather want to cache hpratio? The way this is implemented, it would mean we'd do a sysctl for every call, right? Alex