On Tue, Aug 17, 2021 at 04:11:14PM +0200, Miklos Szeredi wrote: [..] > > As for virtiofs, Dr. David Alan Gilbert has mentioned that various files > > may compete for limited DAX window resource. > > > > Besides, supporting DAX for small files can be expensive. Small files > > can consume DAX window resource rapidly, and if small files are accessed > > only once, the cost of mmap/munmap on host can not be ignored. > > That's a good point. Maybe we should disable DAX for file sizes much > smaller than the chunk size? This indeed seems like a valid concern. 2MB chunk size will consume 512 struct page entries. If an entry is 64 bytes in size, then that's 32K RAM used to access 4K bytes of file. Does not sound like good usage of resources. If we end up selectively disabling dax based on file size, two things come to me mind. - Will be good if it is users can opt-in for this behavior. There might be a class of users who always want to enable dax on all files. - Secondly, we will have to figure out how to do it safely in the event of shared filesystem where file size can change suddenly. Will need to make sure change from dax to no-dax and vice-versa is safe w.r.t page cache and other paths. Thanks Vivek