Re: [PATCH 12/33] userfaultfd: non-cooperative: Add madvise() event for MADV_DONTNEED request

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

 



On Thursday, November 03, 2016 3:34 AM Andrea Arcangeli wrote:
> +void madvise_userfault_dontneed(struct vm_area_struct *vma,
> +				struct vm_area_struct **prev,
> +				unsigned long start, unsigned long end)
> +{
> +	struct userfaultfd_ctx *ctx;
> +	struct userfaultfd_wait_queue ewq;
> +
> +	ctx = vma->vm_userfaultfd_ctx.ctx;
> +	if (!ctx || !(ctx->features & UFFD_FEATURE_EVENT_MADVDONTNEED))
> +		return;
> +
> +	userfaultfd_ctx_get(ctx);
> +	*prev = NULL; /* We wait for ACK w/o the mmap semaphore */
> +	up_read(&vma->vm_mm->mmap_sem);
> +
> +	msg_init(&ewq.msg);
> +
> +	ewq.msg.event = UFFD_EVENT_MADVDONTNEED;
> +	ewq.msg.arg.madv_dn.start = start;
> +	ewq.msg.arg.madv_dn.end = end;
> +
> +	userfaultfd_event_wait_completion(ctx, &ewq);
> +
> +	down_read(&vma->vm_mm->mmap_sem);

After napping with mmap_sem released, is vma still valid?

> +}
> +

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]