linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Joel Savitz <jsavitz@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Nico Pache <npache@redhat.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	 Waiman Long <longman@redhat.com>,
	linux-mm@kvack.org,  Peter Zijlstra <peterz@infradead.org>,
	Michal Hocko <mhocko@suse.com>
Subject: Re: [PATCH] mm/oom_kill: wake futex waiters before annihilating victim shared mutex
Date: Tue, 7 Dec 2021 22:38:00 -0500	[thread overview]
Message-ID: <CAL1p7m48NfO0WfOcQ0F36Wk+YxiVMea-Pr1YCyVktViNfaxQQw@mail.gmail.com> (raw)
In-Reply-To: <20211207175816.8c45ff5b82cb964ade82d6f1@linux-foundation.org>

On Tue, Dec 7, 2021 at 8:58 PM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Tue, 7 Dec 2021 19:46:57 -0500 Nico Pache <npache@redhat.com> wrote:
>
> >
> >
> > On 12/7/21 18:47, Andrew Morton wrote:
> > > (cc's added)
> > >
> > > On Tue,  7 Dec 2021 16:49:02 -0500 Joel Savitz <jsavitz@redhat.com> wrote:
> > >
> > >> In the case that two or more processes share a futex located within
> > >> a shared mmaped region, such as a process that shares a lock between
> > >> itself and a number of child processes, we have observed that when
> > >> a process holding the lock is oom killed, at least one waiter is never
> > >> alerted to this new development and simply continues to wait.
> > >
> > > Well dang.  Is there any way of killing off that waiting process, or do
> > > we have a resource leak here?
> >
> > If I understood your question correctly, there is a way to recover the system by
> > killing the process that is utilizing the futex; however, the purpose of robust
> > futexes is to avoid having to do this.
>
> OK.  My concern was whether we have a way in which userspace can
> permanently leak memory, which opens a (lame) form of denial-of-service
> attack.
I believe the resources are freed when the process is killed so to my
knowledge there is no resource leak in the case we were investigating.

> > >From my work with Joel on this it seems like a race is occurring between the
> > oom_reaper and the exit signal sent to the OMM'd process. By setting the
> > futex_exit_release before these signals are sent we avoid this.
>
> OK.  It would be nice if the patch had some comments explaining *why*
> we're doing this strange futex thing here.  Although that wouldn't be
> necessary if futex_exit_release() was documented...
>
Sounds good, will send a v2 tomorrow

Best,
Joel Savitz



  reply	other threads:[~2021-12-08  6:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-07 21:49 Joel Savitz
2021-12-07 22:32 ` Joel Savitz
2021-12-07 22:34 ` Joel Savitz
2021-12-07 23:47 ` Andrew Morton
2021-12-08  0:46   ` Nico Pache
2021-12-08  1:58     ` Andrew Morton
2021-12-08  3:38       ` Joel Savitz [this message]
2021-12-08  9:01   ` Michal Hocko
2021-12-08 16:05     ` Michal Hocko
2021-12-09  2:59       ` Joel Savitz
2021-12-09  7:51         ` Michal Hocko
2022-01-14 14:39           ` Joel Savitz
2022-01-14 14:55             ` Waiman Long
2022-01-14 14:58               ` Waiman Long
2022-01-17 11:33             ` Michal Hocko

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=CAL1p7m48NfO0WfOcQ0F36Wk+YxiVMea-Pr1YCyVktViNfaxQQw@mail.gmail.com \
    --to=jsavitz@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=longman@redhat.com \
    --cc=mhocko@suse.com \
    --cc=npache@redhat.com \
    --cc=peterz@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