[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJuCfpFYXVVUPH1emd=90S_y8n7t7zq+muYyfvp-rVdECORR4g@mail.gmail.com>
Date: Thu, 2 Jun 2022 08:02:52 -0700
From: Suren Baghdasaryan <surenb@...gle.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Michal Hocko <mhocko@...e.com>,
David Rientjes <rientjes@...gle.com>,
Johannes Weiner <hannes@...xchg.org>,
Roman Gushchin <guro@...com>, Minchan Kim <minchan@...nel.org>,
"Kirill A. Shutemov" <kirill@...temov.name>,
Andrea Arcangeli <aarcange@...hat.com>,
Christian Brauner <brauner@...nel.org>,
Christoph Hellwig <hch@...radead.org>,
Oleg Nesterov <oleg@...hat.com>,
David Hildenbrand <david@...hat.com>,
Jann Horn <jannh@...gle.com>,
Shakeel Butt <shakeelb@...gle.com>,
Peter Xu <peterx@...hat.com>,
John Hubbard <jhubbard@...dia.com>, shuah@...nel.org,
LKML <linux-kernel@...r.kernel.org>,
linux-mm <linux-mm@...ck.org>, linux-kselftest@...r.kernel.org,
kernel-team <kernel-team@...roid.com>,
Liam Howlett <liam.howlett@...cle.com>
Subject: Re: [PATCH RESEND v2 1/2] mm: drop oom code from exit_mmap
On Thu, Jun 2, 2022 at 6:39 AM Matthew Wilcox <willy@...radead.org> wrote:
>
> On Wed, Jun 01, 2022 at 02:47:41PM -0700, Suren Baghdasaryan wrote:
> > > Unclear why this patch fiddles with the mm_struct locking in this
> > > fashion - changelogging that would have been helpful.
> >
> > Yeah, I should have clarified this in the description. Everything up
> > to unmap_vmas() can be done under mmap_read_lock and that way
> > oom-reaper and process_mrelease can do the unmapping in parallel with
> > exit_mmap. That's the reason we take mmap_read_lock, unmap the vmas,
> > mark the mm with MMF_OOM_SKIP and take the mmap_write_lock to execute
> > free_pgtables. I think maple trees do not change that except there is
> > no mm->mmap anymore, so the line at the end of exit_mmap where we
> > reset mm->mmap to NULL can be removed (I show that line below).
>
> I don't understand why we _want_ unmapping to proceed in parallel? Is it
> so urgent to unmap these page tables that we need two processes doing
> it at the same time? And doesn't that just change the contention from
> visible (contention on a lock) to invisible (contention on cachelines)?
It's important for process_madvise() syscall not to be blocked by a
potentially lower priority task doing exit_mmap. I've seen such
priority inversion happening when the dying process is running on a
little core taking its time while a high-priority task is waiting in
the syscall while there is no reason for them to block each other.
>
Powered by blists - more mailing lists