On Fri 23-03-18 19:34:04, Christian König wrote: > Am 23.03.2018 um 18:17 schrieb jglisse@xxxxxxxxxx: > > From: Jérôme Glisse <jglisse@xxxxxxxxxx> > > > > This patchset are the improvements to mmu_notifier i wish to discuss > > at next LSF/MM. I am sending now to give time to people to look at > > them and think about them. > > > > git://people.freedesktop.org/~glisse/linux mmu-notifier-rfc > > https://cgit.freedesktop.org/~glisse/linux/log/?h=mmu-notifier-rfc > > > > First patch just use a struct for invalidate_range_start/end arguments > > this make the other 2 patches easier and smaller. > > > > The idea is to provide more information to mmu_notifier listener on > > the context of each invalidation. When a range is invalidated this > > can be for various reasons (munmap, protection change, OOM, ...). If > > listener can distinguish between those it can take better action. > > > > For instance if device driver allocate structure to track a range of > > virtual address prior to this patch it always have to assume that it > > has to free those on each mmu_notifieir callback (having to assume it > > is a munmap) and reallocate those latter when the device try to do > > something with that range again. > > > > OOM is also an interesting case, recently a patchset was added to > > avoid OOM on a mm if a blocking mmu_notifier listener have been > > registered [1]. This can be improve by adding a new OOM event type and > > having listener take special path on those. All mmu_notifier i know > > can easily have a special path for OOM that do not block (beside > > taking a short lived, across driver, spinlock). If mmu_notifier usage > > grows (from a point of view of more process using devices that rely on > > them) then we should also make sure OOM can do its bidding. > > +1 for better handling that. > > The fact that the OOM killer now avoids processes which might sleep during > their MM destruction gave me a few sleepless night recently. I have tried to clarify this [1] but could you be more specific about the issue you were seeing? [1] http://lkml.kernel.org/r/20180326081356.GA5652@xxxxxxxxxxxxxx -- Michal Hocko SUSE Labs