On Wed 30-06-21 18:15:09, Linus Torvalds wrote: > On Wed, Jun 30, 2021 at 10:25 AM Jan Kara <jack@xxxxxxx> wrote: > > > > could you please pull from > > No. > > There is no way I'll merge something this broken. > > Looking up a page in the page cache is just about the most critical > thing there is, and this introduces a completely pointless lock for > that situation. > > Does it take the lock only when it creates the page? No. It takes the > lock in filemap_fault() even if it found a valid page in the page > cache. Hum, fair point. I did filemap_fault() the way it is because I was mostly just lifting fs-private lock into the VFS one in that code path and ext4/xfs/f2fs and others grabbed this lock unconditionally in their fault paths (before calling into filemap_fault()). But you are right that now that we have the lock in VFS, we can actually do better and have a fast path when everything is cached and uptodate where we can avoid grabbing the lock. That being said I don't expect the optimization to matter too much because in do_read_fault() we first call do_fault_around() which will exactly map pages that are already in cache and uptodate so we usually get into filemap_fault() only for pages that are not present or not uptodate. So do you think the optimization is still worth it despite do_fault_around()? I guess I can try to see how many times I can see a page that would benefit from this optimization in filemap_fault() on my test machine - there are also write faults that don't call do_fault_around() - and if it's noticeable fraction reorganize filemap_fault() so that we don't take the lock if the page is present and uptodate... Honza -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR