On Thu, Aug 05 2021 at 19:24, Matthew Wilcox wrote: > On Thu, Aug 05, 2021 at 10:39:03AM -0700, Darrick J. Wong wrote: >> Though now that I think about it: Why does iomap_write_actor still use >> copy_page_from_iter_atomic? Can that be converted to use regular >> copy_page_from_iter, which at least sometimes uses kmap_local_page? > > I suspect copy_page_from_iter_atomic() should be converted to use > kmap_local_page(), but I don't know. generic_perform_write() uses > the _atomic() version, so I'm not doing anything different without > understanding more than I currently do. Most of the kmap_atomic() usage can be converted to kmap_local(). There are only a few usage sites which really depend on the implicit preempt disable. The reason why we cannot convert the bulk blindly is that quite some usage sites have user memory access nested inside. As kmap_atomic() disables preemption and page faults the error handling needs to be outside the atomic section, i.e. after kunmap_atomic(). So if you convert that you have to get rid of that extra error handling and just use the regular user memory accessors. IIRC there are a few places which really want pagefaults disabled, but those do not necessarily need preemption disabled. So they need to be converted to kmap_local(); pagefault_disable(); err = dostuff(); .... Hope that helps. Thanks tglx