[PATCH] ext4: do prefetchw while the page pointer has been updated

From: Liu Xiang
Date: Sun Mar 03 2019 - 03:22:19 EST


When pages is not NULL, prefetchw(&page->flags) always works on
the last consumed page. This might do little improvment for handling
current page. It is better to do prefetchw while the page pointer
has just been updated.

Signed-off-by: Liu Xiang <liu.xiang6@xxxxxxxxxx>
---
fs/ext4/readpage.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/readpage.c b/fs/ext4/readpage.c
index 6aa282e..0b68dbe 100644
--- a/fs/ext4/readpage.c
+++ b/fs/ext4/readpage.c
@@ -126,14 +126,17 @@ int ext4_mpage_readpages(struct address_space *mapping,
int fully_mapped = 1;
unsigned first_hole = blocks_per_page;

- prefetchw(&page->flags);
if (pages) {
page = lru_to_page(pages);
+
+ prefetchw(&page->flags);
list_del(&page->lru);
if (add_to_page_cache_lru(page, mapping, page->index,
readahead_gfp_mask(mapping)))
goto next_page;
- }
+ } else
+ prefetchw(&page->flags);
+

if (page_has_buffers(page))
goto confused;
--
1.9.1