On Fri, Dec 18, 2015 at 10:01:10AM +0100, Jan Kara wrote: > On Tue 08-12-15 12:18:40, Ross Zwisler wrote: > > Add support for tracking dirty DAX entries in the struct address_space > > radix tree. This tree is already used for dirty page writeback, and it > > already supports the use of exceptional (non struct page*) entries. > > > > In order to properly track dirty DAX pages we will insert new exceptional > > entries into the radix tree that represent dirty DAX PTE or PMD pages. > > These exceptional entries will also contain the writeback addresses for the > > PTE or PMD faults that we can use at fsync/msync time. > > > > There are currently two types of exceptional entries (shmem and shadow) > > that can be placed into the radix tree, and this adds a third. There > > shouldn't be any collisions between these various exceptional entries > > because only one type of exceptional entry should be able to be found in a > > radix tree at a time depending on how it is being used. > > I was thinking about this and I'm not sure the use of exceptional entries > cannot collide. DAX uses page cache for read mapping of holes. When memory > pressure happens, page can get evicted again and entry in the radix tree > will get replaced with a shadow entry. So shadow entries *can* exist in DAX > mappings. Thus at least your change to clear_exceptional_entry() looks > wrong to me. > > Also when we'd like to insert DAX radix tree entry, we have to count with > the fact that there can be shadow entry in place and we have to tear it > down properly. You are right, thank you for catching this. I think the correct thing to do is to just explicitly disallow having shadow entries in trees for DAX mappings. As you say the only usage is to track zero page mappings for reading holes which will get minimal benefit from shadow entries, and this choice makes the logic both in clear_exceptional_entry() and in the rest of the DAX code simpler. I've sent out a v5 that fixes this issue. -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html