Re: [PATCH unit-tests] Add async page fault test

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

 



On Wed, May 09, 2012 at 11:52:41AM +0300, Avi Kivity wrote:
> On 05/09/2012 11:41 AM, Gleb Natapov wrote:
> > > 
> > > >  void vfree(void *mem)
> > > >  {
> > > >      unsigned long size = ((unsigned long *)mem)[-1];
> > > > diff --git a/lib/x86/vm.h b/lib/x86/vm.h
> > > > index 71ab4a8..ff4842f 100644
> > > > --- a/lib/x86/vm.h
> > > > +++ b/lib/x86/vm.h
> > > > @@ -22,6 +22,7 @@ void vfree(void *mem);
> > > >  void *vmap(unsigned long long phys, unsigned long size);
> > > >  void *alloc_vpage(void);
> > > >  void *alloc_vpages(ulong nr);
> > > > +unsigned long virt_to_phys_cr3(void *mem);
> > > 
> > > uint64_t.
> > virt_to_phys() also unsigned long. And get_pte() that virt_to_phys_cr3()
> > uses also. I guess the code is not ready for more then 2^32 memory in
> > 32bit VM.
> 
> It's certainly not enterprise quality yet.  But let's not add more problems.
> 
Okay.

> > > Alterative ways of doing this:
> > > - file-backed memory using FUSE to control paging
> > Not sure how that can be done.
> >
> > > - add madvise(MADV_DONTNEED) support to testdev, and have the guest
> > > trigger page-in itself.
> > MADV_DONTNEED will drop page, not swap it out.
> 
> Right, but it will be have to be reloaded from disk (it has to be
> file-backed for this to work).  If it's dirty, sync it first.
> 
Hmm, yes if it is file backed it may work. Setting up qemu to use file
backed memory is one more complication while running the test though.
I haven't checked by I am not sure that MADV_DONTNEED will drop page
immediately though. It probably puts it on some list to be freed later.
Hmm actually looking at the comments it seems like this is what happens:

/*
 * Application no longer needs these pages.  If the pages are dirty,
 * it's OK to just throw them away.  The app will be more careful about
 * data it wants to keep.  Be sure to free swap resources too.  The
 * zap_page_range call sets things up for shrink_active_list to actually
 * free
 * these pages later if no one else has touched them in the meantime,
 * although we could add these pages to a global reuse list for
 * shrink_active_list to pick up before reclaiming other pages.
 */

--
			Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux