linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Suren Baghdasaryan <surenb@google.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Michal Hocko <mhocko@suse.com>,
	 David Rientjes <rientjes@google.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Roman Gushchin <guro@fb.com>,  Minchan Kim <minchan@kernel.org>,
	"Kirill A. Shutemov" <kirill@shutemov.name>,
	 Andrea Arcangeli <aarcange@redhat.com>,
	Christian Brauner <brauner@kernel.org>,
	 Christoph Hellwig <hch@infradead.org>,
	Oleg Nesterov <oleg@redhat.com>,
	 David Hildenbrand <david@redhat.com>,
	Jann Horn <jannh@google.com>, Shakeel Butt <shakeelb@google.com>,
	 Peter Xu <peterx@redhat.com>, John Hubbard <jhubbard@nvidia.com>,
	shuah@kernel.org,  LKML <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	 linux-kselftest@vger.kernel.org,
	kernel-team <kernel-team@android.com>,
	 Liam Howlett <liam.howlett@oracle.com>
Subject: Re: [PATCH RESEND v2 1/2] mm: drop oom code from exit_mmap
Date: Thu, 2 Jun 2022 08:02:52 -0700	[thread overview]
Message-ID: <CAJuCfpFYXVVUPH1emd=90S_y8n7t7zq+muYyfvp-rVdECORR4g@mail.gmail.com> (raw)
In-Reply-To: <Ypi9pOXfuyPJ24pe@casper.infradead.org>

On Thu, Jun 2, 2022 at 6:39 AM Matthew Wilcox <willy@infradead.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.

>


      reply	other threads:[~2022-06-02 15:03 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-31 22:30 Suren Baghdasaryan
2022-05-31 22:31 ` [PATCH RESEND v2 2/2] mm: delete unused MMF_OOM_VICTIM flag Suren Baghdasaryan
2022-08-22 22:21   ` Andrew Morton
2022-08-22 22:33     ` Yu Zhao
2022-08-22 22:48       ` Andrew Morton
2022-08-22 22:59         ` Yu Zhao
2022-08-22 23:16           ` Andrew Morton
2022-08-22 23:20             ` Yu Zhao
2022-08-23  8:36               ` Michal Hocko
2022-08-28 19:50                 ` Yu Zhao
2022-06-01 21:36 ` [PATCH RESEND v2 1/2] mm: drop oom code from exit_mmap Andrew Morton
2022-06-01 21:47   ` Suren Baghdasaryan
2022-06-01 21:50     ` Suren Baghdasaryan
2022-06-02  6:53     ` Michal Hocko
2022-06-02 13:31       ` Liam Howlett
2022-06-02 14:08         ` Michal Hocko
2022-06-02 13:39     ` Matthew Wilcox
2022-06-02 15:02       ` Suren Baghdasaryan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJuCfpFYXVVUPH1emd=90S_y8n7t7zq+muYyfvp-rVdECORR4g@mail.gmail.com' \
    --to=surenb@google.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=david@redhat.com \
    --cc=guro@fb.com \
    --cc=hannes@cmpxchg.org \
    --cc=hch@infradead.org \
    --cc=jannh@google.com \
    --cc=jhubbard@nvidia.com \
    --cc=kernel-team@android.com \
    --cc=kirill@shutemov.name \
    --cc=liam.howlett@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=minchan@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterx@redhat.com \
    --cc=rientjes@google.com \
    --cc=shakeelb@google.com \
    --cc=shuah@kernel.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox