linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yin Fengwei <fengwei.yin@intel.com>
To: willy@infradead.org, linux-mm@kvack.org
Cc: fengwei.yin@intel.com
Subject: [RFC PATCH 1/2] mm: remove duplicated flush_dcache_folio()
Date: Fri, 17 Feb 2023 00:05:27 +0800	[thread overview]
Message-ID: <20230216160528.2146188-2-fengwei.yin@intel.com> (raw)
In-Reply-To: <20230216160528.2146188-1-fengwei.yin@intel.com>

folio_zero_range() calls the flush_dcache_folio() already. Remove
unnecessary flush_dcache_folio() call.

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
---
 fs/libfs.c | 1 -
 mm/shmem.c | 7 +------
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/fs/libfs.c b/fs/libfs.c
index 4eda519c3002..d57370c8e382 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -543,7 +543,6 @@ EXPORT_SYMBOL(simple_setattr);
 static int simple_read_folio(struct file *file, struct folio *folio)
 {
 	folio_zero_range(folio, 0, folio_size(folio));
-	flush_dcache_folio(folio);
 	folio_mark_uptodate(folio);
 	folio_unlock(folio);
 	return 0;
diff --git a/mm/shmem.c b/mm/shmem.c
index 448f393d8ab2..66e50f0a15ab 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1401,7 +1401,6 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc)
 				goto redirty;
 		}
 		folio_zero_range(folio, 0, folio_size(folio));
-		flush_dcache_folio(folio);
 		folio_mark_uptodate(folio);
 	}
 
@@ -2010,11 +2009,7 @@ static int shmem_get_folio_gfp(struct inode *inode, pgoff_t index,
 	 * it now, lest undo on failure cancel our earlier guarantee.
 	 */
 	if (sgp != SGP_WRITE && !folio_test_uptodate(folio)) {
-		long i, n = folio_nr_pages(folio);
-
-		for (i = 0; i < n; i++)
-			clear_highpage(folio_page(folio, i));
-		flush_dcache_folio(folio);
+		folio_zero_range(folio, 0, folio_size(folio));
 		folio_mark_uptodate(folio);
 	}
 
-- 
2.30.2



  reply	other threads:[~2023-02-16 16:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-16 16:05 [RFC PATCH 0/2] minor cleanup of usage of flush_dcache_folio() Yin Fengwei
2023-02-16 16:05 ` Yin Fengwei [this message]
2023-02-27  5:46   ` [RFC PATCH 1/2] mm: remove duplicated flush_dcache_folio() Ira Weiny
2023-02-27  6:14     ` Yin, Fengwei
2023-02-16 16:05 ` [RFC PATCH 2/2] mm: add zero_user_folio_segments() Yin Fengwei
2023-02-16 19:19   ` Matthew Wilcox
2023-02-17  2:21     ` Yin, Fengwei
2023-02-27  5:31   ` Ira Weiny
2023-02-27  5:44     ` Yin, Fengwei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230216160528.2146188-2-fengwei.yin@intel.com \
    --to=fengwei.yin@intel.com \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox