Re: [Qemu-devel] [PATCH 1/4] mm: madvise MADV_USERFAULT

2013-05-07 Thread Andrea Arcangeli
Hi Andrew, On Tue, May 07, 2013 at 01:16:30PM +0200, Andrew Jones wrote: > On Mon, May 06, 2013 at 09:56:58PM +0200, Andrea Arcangeli wrote: > > @@ -405,6 +420,7 @@ madvise_behavior_valid(int behavior) > > case MADV_HUGEPAGE: > > case MADV_NOHUGEPAGE: > > #endif > > + case MADV_USERFAUL

Re: [Qemu-devel] [PATCH 1/4] mm: madvise MADV_USERFAULT

2013-05-07 Thread Andrew Jones
On Mon, May 06, 2013 at 09:56:58PM +0200, Andrea Arcangeli wrote: > +++ b/mm/madvise.c > @@ -93,6 +93,21 @@ static long madvise_behavior(struct vm_area_struct * vma, > if (error) > goto out; > break; > + case MADV_USERFAULT: > + if (

[Qemu-devel] [PATCH 1/4] mm: madvise MADV_USERFAULT

2013-05-06 Thread Andrea Arcangeli
MADV_USERFAULT is a new madvise flag that will set VM_USERFAULT in the vma flags. Whenever VM_USERFAULT is set in an anonymous vma, if userland touches a still unmapped virtual address, a sigbus signal is sent instead of allocating a new page. The sigbus signal handler will then resolve the page fa