All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/filemap: Use filemap_read_page in filemap_fault
@ 2021-02-26 14:00 Matthew Wilcox (Oracle)
  2021-03-03  1:30 ` Andrew Morton
  0 siblings, 1 reply; 9+ messages in thread
From: Matthew Wilcox (Oracle) @ 2021-02-26 14:00 UTC (permalink / raw)
  To: linux-mm, linux-fsdevel, Kent Overstreet, Christoph Hellwig,
	Andrew Morton
  Cc: Matthew Wilcox (Oracle)

After splitting generic_file_buffered_read() into smaller parts, it
turns out we can reuse one of the parts in filemap_fault().  This fixes
an oversight -- waiting for the I/O to complete is now interruptible
by a fatal signal.  And it saves us a few bytes of text in an unlikely
path.

$ ./scripts/bloat-o-meter before.o after.o
add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-207 (-207)
Function                                     old     new   delta
filemap_fault                               2187    1980    -207
Total: Before=37491, After=37284, chg -0.55%

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 mm/filemap.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index 46a8b9e82434..f7ab86d13692 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2748,7 +2748,6 @@ vm_fault_t filemap_fault(struct vm_fault *vmf)
 	struct file *file = vmf->vma->vm_file;
 	struct file *fpin = NULL;
 	struct address_space *mapping = file->f_mapping;
-	struct file_ra_state *ra = &file->f_ra;
 	struct inode *inode = mapping->host;
 	pgoff_t offset = vmf->pgoff;
 	pgoff_t max_off;
@@ -2835,14 +2834,8 @@ vm_fault_t filemap_fault(struct vm_fault *vmf)
 	 * because there really aren't any performance issues here
 	 * and we need to check for errors.
 	 */
-	ClearPageError(page);
 	fpin = maybe_unlock_mmap_for_io(vmf, fpin);
-	error = mapping->a_ops->readpage(file, page);
-	if (!error) {
-		wait_on_page_locked(page);
-		if (!PageUptodate(page))
-			error = -EIO;
-	}
+	error = filemap_read_page(file, mapping, page);
 	if (fpin)
 		goto out_retry;
 	put_page(page);
@@ -2850,7 +2843,6 @@ vm_fault_t filemap_fault(struct vm_fault *vmf)
 	if (!error || error == AOP_TRUNCATED_PAGE)
 		goto retry_find;
 
-	shrink_readahead_size_eio(ra);
 	return VM_FAULT_SIGBUS;
 
 out_retry:
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-03-04  0:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-26 14:00 [PATCH] mm/filemap: Use filemap_read_page in filemap_fault Matthew Wilcox (Oracle)
2021-03-03  1:30 ` Andrew Morton
2021-03-03  1:33   ` Matthew Wilcox
2021-03-03  6:07     ` Andrew Morton
2021-03-03 13:26       ` Matthew Wilcox
2021-03-03 20:12         ` Andrew Morton
2021-03-03 20:57           ` Matthew Wilcox
2021-03-03 21:51             ` Andrew Morton
2021-03-03 22:31               ` Matthew Wilcox

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.