nvdimm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] mm: rmap: fix cache flush on THP pages
@ 2022-01-21  7:55 Muchun Song
  2022-01-21  7:55 ` [PATCH 2/5] dax: fix cache flush on PMD-mapped pages Muchun Song
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Muchun Song @ 2022-01-21  7:55 UTC (permalink / raw)
  To: dan.j.williams, willy, jack, viro, akpm, apopple, shy828301,
	rcampbell, hughd, xiyuyang19, kirill.shutemov, zwisler
  Cc: linux-fsdevel, nvdimm, linux-kernel, linux-mm, Muchun Song

The flush_cache_page() only remove a PAGE_SIZE sized range from the cache.
However, it does not cover the full pages in a THP except a head page.
Replace it with flush_cache_range() to fix this issue. At least, no
problems were found due to this. Maybe because the architectures that
have virtual indexed caches is less.

Fixes: f27176cfc363 ("mm: convert page_mkclean_one() to use page_vma_mapped_walk()")
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
---
 mm/rmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/rmap.c b/mm/rmap.c
index b0fd9dc19eba..65670cb805d6 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -974,7 +974,7 @@ static bool page_mkclean_one(struct page *page, struct vm_area_struct *vma,
 			if (!pmd_dirty(*pmd) && !pmd_write(*pmd))
 				continue;
 
-			flush_cache_page(vma, address, page_to_pfn(page));
+			flush_cache_range(vma, address, address + HPAGE_PMD_SIZE);
 			entry = pmdp_invalidate(vma, address, pmd);
 			entry = pmd_wrprotect(entry);
 			entry = pmd_mkclean(entry);
-- 
2.11.0


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

end of thread, other threads:[~2022-01-24  9:08 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-21  7:55 [PATCH 1/5] mm: rmap: fix cache flush on THP pages Muchun Song
2022-01-21  7:55 ` [PATCH 2/5] dax: fix cache flush on PMD-mapped pages Muchun Song
2022-01-24  7:34   ` Christoph Hellwig
2022-01-21  7:55 ` [PATCH 3/5] mm: page_vma_mapped: support checking if a pfn is mapped into a vma Muchun Song
2022-01-24  7:36   ` Christoph Hellwig
2022-01-24  9:01     ` Muchun Song
2022-01-21  7:55 ` [PATCH 4/5] dax: fix missing writeprotect the pte entry Muchun Song
2022-01-24  7:41   ` Christoph Hellwig
2022-01-24  9:07     ` Muchun Song
2022-01-21  7:55 ` [PATCH 5/5] mm: remove range parameter from follow_invalidate_pte() Muchun Song
2022-01-21 18:05 ` [PATCH 1/5] mm: rmap: fix cache flush on THP pages Yang Shi
2022-01-24  7:34 ` Christoph Hellwig
2022-01-24  8:51   ` Muchun Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).