On Sat, Mar 19 2016, Jan Kara wrote: > > Actually, after some thought I don't think the wakeup is needed except for > dax_pfn_mkwrite(). In the other cases we know there is no radix tree > exceptional entry and thus there can be no waiters for its lock... > I think that is fragile logic - though it may be correct at present. A radix tree slot can transition from "Locked exception" to "unlocked exception" to "deleted" to "struct page". So it is absolutely certain that a thread cannot go to sleep after finding a "locked exception" and wake up to find a "struct page" ?? How about a much simpler change. - new local variable "slept" in lookup_unlocked_mapping_entry() which is set if prepare_to_wait_exclusive() gets called. - if after __radix_tree_lookup() returns: (ret==NULL || !radix_tree_exceptional_entry(ret)) && slept then it calls wakeup immediately - because if it was waiting, something else might be to. That would cover all vaguely possible cases except dax_pfn_mkwrite() Thanks, NeilBrown