[PATCH 05/12] shmem: clear_highpage() if block is not uptodate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



clear_highpage() is called for all the subpages (blocks) in a large
folio when the folio is not uptodate. Do clear the subpages only when
they are not uptodate.

Signed-off-by: Daniel Gomez <da.gomez@xxxxxxxxxxx>
---
 mm/shmem.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index 69f3b98fdf7c..04992010225f 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2256,7 +2256,8 @@ static int shmem_get_folio_gfp(struct inode *inode, pgoff_t index,
 		long i, n = folio_nr_pages(folio);
 
 		for (i = 0; i < n; i++)
-			clear_highpage(folio_page(folio, i));
+			if (!shmem_is_block_uptodate(folio, i))
+				clear_highpage(folio_page(folio, i));
 		flush_dcache_folio(folio);
 		shmem_set_range_uptodate(folio, 0, folio_size(folio));
 	}
-- 
2.43.0





[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux