lkml.org 
[lkml]   [2023]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH v17 03/14] shmem: Implement splice-read
Date
Linus Torvalds <torvalds@linux-foundation.org> wrote:

> But please at least stop doing the
>
> get_page(buf->page);
>
> on the zero-page (which includes using no-op .get and .put functions
> in zero_pipe_buf_ops().

I'll make the attached change. It seems to work.

David
---
diff --git a/mm/shmem.c b/mm/shmem.c
index 3cbec1d56112..d9b60ab556fe 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2719,6 +2719,17 @@ static ssize_t shmem_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
return retval ? retval : error;
}

+static bool zero_pipe_buf_get(struct pipe_inode_info *pipe,
+ struct pipe_buffer *buf)
+{
+ return true;
+}
+
+static void zero_pipe_buf_release(struct pipe_inode_info *pipe,
+ struct pipe_buffer *buf)
+{
+}
+
static bool zero_pipe_buf_try_steal(struct pipe_inode_info *pipe,
struct pipe_buffer *buf)
{
@@ -2726,9 +2737,9 @@ static bool zero_pipe_buf_try_steal(struct pipe_inode_info *pipe,
}

static const struct pipe_buf_operations zero_pipe_buf_ops = {
- .release = generic_pipe_buf_release,
+ .release = zero_pipe_buf_release,
.try_steal = zero_pipe_buf_try_steal,
- .get = generic_pipe_buf_get,
+ .get = zero_pipe_buf_get,
};

static size_t splice_zeropage_into_pipe(struct pipe_inode_info *pipe,
\
 
 \ /
  Last update: 2023-03-27 01:00    [W:0.060 / U:1.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site