Ok. I guess we need to have a __register_mmu_notifier that expects the
mmap_sem to be held then?
No you cannot do that because there are still callbacks that come later.
The invalidate_all may lead to invalidate_range() doing nothing for this
mm. The ops notifier and the freeing of the structure has to wait until
release().
That does not sync with the current scheme of the invalidate_range()
hooks. We would have to do a global invalidate early and then place the
other invalidate_range hooks in such a way that none is called in later in
process exit handling.
--