To be honest, I didn't read this patch carefully, but let me ask anyway.
On 05/22, Breno Leitao wrote:
>
> @@ -432,6 +524,7 @@ anon_pipe_write(struct kiocb *iocb, struct iov_iter *from)
> {
> struct file *filp = iocb->ki_filp;
> struct pipe_inode_info *pipe = filp->private_data;
> + struct anon_pipe_prealloc prealloc;
> unsigned int head;
> ssize_t ret = 0;
> size_t total_len = iov_iter_count(from);
> @@ -455,6 +548,8 @@ anon_pipe_write(struct kiocb *iocb, struct iov_iter *from)
> if (unlikely(total_len == 0))
> return 0;
>
> + anon_pipe_get_page_prealloc(&prealloc, total_len);
> +
> mutex_lock(&pipe->mutex);
>
> if (!pipe->readers) {
> @@ -512,7 +607,7 @@ anon_pipe_write(struct kiocb *iocb, struct iov_iter *from)
> struct page *page;
> int copied;
>
> - page = anon_pipe_get_page(pipe);
> + page = anon_pipe_get_page(pipe, &prealloc);
> if (unlikely(!page)) {
> if (!ret)
> ret = -ENOMEM;
> @@ -566,7 +661,9 @@ anon_pipe_write(struct kiocb *iocb, struct iov_iter *from)
> * after waiting we need to re-check whether the pipe
> * become empty while we dropped the lock.
> */
> + anon_pipe_refill_tmp_pages(pipe, &prealloc);
> mutex_unlock(&pipe->mutex);
> + anon_pipe_free_pages(&prealloc);
Do we really want to call anon_pipe_free_pages() at this point?
The main loop will continue when pipe_writable() becomes true again...
Oleg.