Hi Andy,
Thanks for the explanation. The postgres benchmark I am running:
pg_test_fsync, uses file system calls open(), write(), fsync() and close(). It doesn't do any mmap.
So if I understand correctly internally linux-ext4-dax issues CLWBs for all cachelines in the virtual address range being touched. Linux is free to optimize away some of these CLWBs if the pages are clean.
This still does not explain the benchmark numbers. I notice that only on pmem running ext4 in dax mode, unsynced writes are slower than writes+fsync. Particularly,
A loop of { open(), write(), close() } IS SLOWER than open() + loop of { write(), fsync() } + close().
This only happens for a file on pmem running ext4 on dax mode. On pmem running ext4 in block mode or on SSDs running ext4 filesystem, unsync'ed writes are faster than sync'ed writes.
I am not sure if I am missing something.
Thanks,
Mohit