From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx176.postini.com [74.125.245.176]) by kanga.kvack.org (Postfix) with SMTP id 29F406B0031 for ; Thu, 25 Jul 2013 13:30:26 -0400 (EDT) Message-ID: <51F160A5.2040004@sr71.net> Date: Thu, 25 Jul 2013 10:30:13 -0700 From: Dave Hansen MIME-Version: 1.0 Subject: Re: [RFC PATCH 1/2] vmsplice unmap gifted pages for recipient References: <1374772906-21511-1-git-send-email-rcj@linux.vnet.ibm.com> <1374772906-21511-2-git-send-email-rcj@linux.vnet.ibm.com> In-Reply-To: <1374772906-21511-2-git-send-email-rcj@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Robert Jennings Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Alexander Viro , Rik van Riel , Andrea Arcangeli , Matt Helsley , Anthony Liguori , Michael Roth , Lei Li , Leonardo Garcia On 07/25/2013 10:21 AM, Robert Jennings wrote: > +static void zap_buf_page(unsigned long useraddr) > +{ > + struct vm_area_struct *vma; > + > + down_read(¤t->mm->mmap_sem); > + vma = find_vma_intersection(current->mm, useraddr, > + useraddr + PAGE_SIZE); > + if (!IS_ERR_OR_NULL(vma)) > + zap_page_range(vma, useraddr, PAGE_SIZE, NULL); > + up_read(¤t->mm->mmap_sem); > +} > + > /** > * splice_to_pipe - fill passed data into a pipe > * @pipe: pipe to fill > @@ -212,8 +224,16 @@ ssize_t splice_to_pipe(struct pipe_inode_info *pipe, > buf->len = spd->partial[page_nr].len; > buf->private = spd->partial[page_nr].private; > buf->ops = spd->ops; > - if (spd->flags & SPLICE_F_GIFT) > + if (spd->flags & SPLICE_F_GIFT) { > + unsigned long useraddr = > + spd->partial[page_nr].useraddr; > + > + if ((spd->flags & SPLICE_F_MOVE) && > + !buf->offset && (buf->len == PAGE_SIZE)) > + /* Can move page aligned buf */ > + zap_buf_page(useraddr); > buf->flags |= PIPE_BUF_FLAG_GIFT; > + } There isn't quite enough context here, but is it going to do this zap_buf_page() very often? Seems a bit wasteful to do the up/down and find_vma() every trip through the loop. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org