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

From: Andrew Jones
Date: Tue May 07 2013 - 07:16:49 EST


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 (vma->vm_ops) {
> + error = -EINVAL;
> + goto out;
> + }
> + new_flags |= VM_USERFAULT;
> + break;
> + case MADV_NOUSERFAULT:
> + if (vma->vm_ops) {
> + WARN_ON(new_flags & VM_USERFAULT);
> + error = -EINVAL;
> + goto out;
> + }
> + new_flags &= ~VM_USERFAULT;
> + break;
> }
>
> if (new_flags == vma->vm_flags) {
> @@ -405,6 +420,7 @@ madvise_behavior_valid(int behavior)
> case MADV_HUGEPAGE:
> case MADV_NOHUGEPAGE:
> #endif
> + case MADV_USERFAULT:

Missing MADV_NOUSERFAULT: here

> case MADV_DONTDUMP:
> case MADV_DODUMP:
> return 1;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/