Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1723548
| From | Andrea Arcangeli <aarcange@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC PATCH] mm, oom_reaper: skip mm structs with mmu notifiers |
| Date | 2017-08-30 20:00 +0200 |
| Message-ID | <ukfrs-2W1-13@gated-at.bofh.it> (permalink) |
| References | <uk6Rd-63h-41@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hello Michal,
On Wed, Aug 30, 2017 at 10:46:00AM +0200, Michal Hocko wrote:
> + * TODO: we really want to get rid of this ugly hack and make sure that
> + * notifiers cannot block for unbounded amount of time and add
> + * mmu_notifier_invalidate_range_{start,end} around unmap_page_range
KVM already should be ok in that respect. However the major reason to
prefer mmu_notifier_invalidate_range_start/end is those can block and
schedule waiting for stuff happening behind the PCI bus easily. So I'm
not sure if the TODO is good idea to keep.
> + */
> + if (mm_has_notifiers(mm)) {
> + schedule_timeout_idle(HZ);
Why the schedule_timeout? What's the difference with the OOM
reaper going to sleep again in the main loop instead?
> + goto unlock_oom;
> + }
mm_has_notifiers stops changing after obtaining the mmap_sem for
reading. See the do_mmu_notifier_register. So it's better to put the
mm_has_notifiers check immediately after the below:
> if (!down_read_trylock(&mm->mmap_sem)) {
> ret = false;
> trace_skip_task_reaping(tsk->pid);
If we succeed taking the mmap_sem for reading then we read a stable
value out of mm_has_notifiers and be sure it won't be set from under
us.
Otherwise the patch looks fine including the incremental comment about
why the mmu_notifier_invalidate_range in MMU gather wasn't enough.
Thanks!
Andrea
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC PATCH] mm, oom_reaper: skip mm structs with mmu notifiers Michal Hocko <mhocko@kernel.org> - 2017-08-30 10:50 +0200
Re: [RFC PATCH] mm, oom_reaper: skip mm structs with mmu notifiers Michal Hocko <mhocko@kernel.org> - 2017-08-30 11:10 +0200
Re: [RFC PATCH] mm, oom_reaper: skip mm structs with mmu notifiers Andrea Arcangeli <aarcange@redhat.com> - 2017-08-30 20:00 +0200
Re: [RFC PATCH] mm, oom_reaper: skip mm structs with mmu notifiers Michal Hocko <mhocko@kernel.org> - 2017-08-31 07:30 +0200
csiph-web