summaryrefslogtreecommitdiff
path: root/mm/util.c
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2020-12-16 19:06:33 +0300
committerMatthew Wilcox (Oracle) <willy@infradead.org>2021-10-18 14:49:36 +0300
commit08b0b0059bf1c2e8637f724cc7cc4d29b1e808de (patch)
tree795315583bdbd72e41a2509662d48f377d477893 /mm/util.c
parent646010009d3541b8cb4f803dcb4b8d0da2f22579 (diff)
downloadlinux-08b0b0059bf1c2e8637f724cc7cc4d29b1e808de.tar.xz
mm: Add flush_dcache_folio()
This is a default implementation which calls flush_dcache_page() on each page in the folio. If architectures can do better, they should implement their own version of it. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Acked-by: Vlastimil Babka <vbabka@suse.cz>
Diffstat (limited to 'mm/util.c')
-rw-r--r--mm/util.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/mm/util.c b/mm/util.c
index 96a5e7185f65..bf860838282c 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -1076,3 +1076,14 @@ void page_offline_end(void)
up_write(&page_offline_rwsem);
}
EXPORT_SYMBOL(page_offline_end);
+
+#ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_FOLIO
+void flush_dcache_folio(struct folio *folio)
+{
+ long i, nr = folio_nr_pages(folio);
+
+ for (i = 0; i < nr; i++)
+ flush_dcache_page(folio_page(folio, i));
+}
+EXPORT_SYMBOL(flush_dcache_folio);
+#endif