From: Nico Pache <npache@redhat.com>
To: Michal Hocko <mhocko@suse.com>
Cc: Waiman Long <longman@redhat.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
akpm@linux-foundation.org, jsavitz@redhat.com,
peterz@infradead.org, tglx@linutronix.de, mingo@redhat.com,
dvhart@infradead.org, dave@stgolabs.net,
andrealmeid@collabora.com
Subject: Re: [PATCH v3] mm/oom: do not oom reap task with an unresolved robust futex
Date: Wed, 2 Mar 2022 12:26:45 -0500 [thread overview]
Message-ID: <7f1ba14f-34e8-5f05-53b7-c12913693df8@redhat.com> (raw)
In-Reply-To: <Yh9+O/xqNLnV1jmA@dhcp22.suse.cz>
On 3/2/22 09:24, Michal Hocko wrote:
> Sorry, this has slipped through cracks.
>
> On Mon 14-02-22 15:39:31, Nico Pache wrote:
> [...]
>> We've recently been discussing the following if statement in __oom_reap_task_mm:
>> if (vma_is_anonymous(vma) || !(vma->vm_flags & VM_SHARED))
>>
>> Given the comment above it, and some of the upstream discussion the original
>> RFC, we are struggling to see why this should be a `||` and not an `&&`. If we
>> only want to reap anon memory and reaping shared memory can be dangerous is this
>> statement incorrect?
>>
>> We have a patch queued up to make this change, but wanted to get your opinion on
>> why this was originally designed this way in case we are missing something.
>
> I do not really see why this would be wrong. Private file backed
> mappings can contain a reapable memory as well. I do not see how this
> would solve the futex issue.
We were basing our discussion around the following comment:
/*
* Only anonymous pages have a good chance to be dropped
* without additional steps which we cannot afford as we
* are OOM already.
*
* We do not even care about fs backed pages because all
* which are reclaimable have already been reclaimed and
* we do not want to block exit_mmap by keeping mm ref
* count elevated without a good reason.
*/
So changing to an && would align the functionality with this comment by ignoring
fs backed pages, and additionally it prevents shared mappings from being reaped.
We have tested this change and found we can no longer reproduce the issue. In
our case we allocate the mutex on a MAP_SHARED|MAP_ANONYMOUS mmap so the if-
statement in question would no longer return true after the && change.
If it is the case that private fs backed pages matter perhaps we want something
like this:
if ((vma_is_anonymous(vma) && !(vma->vm_flags & VM_SHARED))
||(!vma_is_anonymous(vma) && !(vma->vm_flags & VM_SHARED)))
or more simply:
if(!(vma->vm_flags & VM_SHARED))
to exclude all VM_SHARED mappings.
-- Nico
next prev parent reply other threads:[~2022-03-02 17:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-14 18:01 [PATCH v3] mm/oom: do not oom reap task with an unresolved robust futex Nico Pache
2022-01-17 8:52 ` Michal Hocko
2022-01-17 16:05 ` Waiman Long
2022-01-17 22:56 ` Nico Pache
2022-01-18 8:51 ` Michal Hocko
2022-02-14 20:39 ` Nico Pache
2022-03-02 14:24 ` Michal Hocko
2022-03-02 17:26 ` Nico Pache [this message]
2022-03-03 7:48 ` Michal Hocko
2022-03-09 0:24 ` Nico Pache
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=7f1ba14f-34e8-5f05-53b7-c12913693df8@redhat.com \
--to=npache@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=andrealmeid@collabora.com \
--cc=dave@stgolabs.net \
--cc=dvhart@infradead.org \
--cc=jsavitz@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=longman@redhat.com \
--cc=mhocko@suse.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).