pmem: add wb_cache_pmem() to the PMEM API

__arch_wb_cache_pmem() was already an internal implementation detail of
the x86 PMEM API, but this functionality needs to be exported as part of
the general PMEM API to handle the fsync/msync case for DAX mmaps.

One thing worth noting is that we really do want this to be part of the
PMEM API as opposed to a stand-alone function like clflush_cache_range()
because of ordering restrictions.  By having wb_cache_pmem() as part of
the PMEM API we can leave it unordered, call it multiple times to write
back large amounts of memory, and then order the multiple calls with a
single wmb_pmem().

Signed-off-by: Ross Zwisler <>
Cc: "H. Peter Anvin" <>
Cc: "J. Bruce Fields" <>
Cc: "Theodore Ts'o" <>
Cc: Alexander Viro <>
Cc: Andreas Dilger <>
Cc: Dave Chinner <>
Cc: Ingo Molnar <>
Cc: Jan Kara <>
Cc: Jeff Layton <>
Cc: Matthew Wilcox <>
Cc: Thomas Gleixner <>
Cc: Dan Williams <>
Cc: Matthew Wilcox <>
Cc: Dave Hansen <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>
2 files changed