linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Joel Fernandes <joelaf@google.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Zhaoyang Huang <huangzhaoyang@gmail.com>,
	Ingo Molnar <mingo@kernel.org>,
	kernel-patch-test@lists.linaro.org,
	Andrew Morton <akpm@linux-foundation.org>,
	"open list:MEMORY MANAGEMENT" <linux-mm@kvack.org>,
	Vlastimil Babka <vbabka@suse.cz>
Subject: Re: [PATCH] ring-buffer: Add set/clear_current_oom_origin() during allocations
Date: Thu, 5 Apr 2018 12:47:45 -0700	[thread overview]
Message-ID: <CAJWu+ooQfN-5tzdEm6=4qTZcvFK+g2GMfX59_9-xkMvwmAk1Rg@mail.gmail.com> (raw)
In-Reply-To: <20180405145159.GM6312@dhcp22.suse.cz>

On Thu, Apr 5, 2018 at 7:51 AM, Michal Hocko <mhocko@kernel.org> wrote:
> On Wed 04-04-18 16:59:18, Joel Fernandes wrote:
>> Hi Steve,
>>
>> On Wed, Apr 4, 2018 at 9:18 AM, Joel Fernandes <joelaf@google.com> wrote:
>> > On Wed, Apr 4, 2018 at 9:13 AM, Steven Rostedt <rostedt@goodmis.org> wrote:
>> > [..]
>> >>>
>> >>> Also, I agree with the new patch and its nice idea to do that.
>> >>
>> >> Thanks, want to give it a test too?
>>
>> With the latest tree and the below diff, I can still OOM-kill a victim
>> process doing a large buffer_size_kb write:
>>
>> I pulled your ftrace/core and added this:
>> +       /*
>>         i = si_mem_available();
>>         if (i < nr_pages)
>>                 return -ENOMEM;
>> +       */
>>
>> Here's a run in Qemu with 4-cores 1GB total memory:
>>
>> bash-4.3# ./m -m 1M &
>> [1] 1056
>> bash-4.3#
>> bash-4.3#
>> bash-4.3#
>> bash-4.3# echo 10000000 > /d/tracing/buffer_size_kb
>> [   33.213988] Out of memory: Kill process 1042 (bash) score
>> 1712050900 or sacrifice child
>> [   33.215349] Killed process 1056 (m) total-vm:9220kB,
>> anon-rss:7564kB, file-rss:4kB, shmem-rss:640kB
>
> OK, so the reason your memory hog is triggered is that your echo is
> built-in and we properly select bask as an oom_origin but then another
> clever heuristic jumps in and tries to reduce the damage by sacrificing
> a child process. And your memory hog runs as a child from the same bash
> session.

Oh, ok. Makes sense.

>
> I cannot say I would love this heuristic. In fact I would really love to
> dig it deep under the ground. But this is a harder sell than it might
> seem. Anyway is your testing scenario really representative enough to

No honestly I don't care much for this heuristic but was just helping
test it. The scenario is not something I care about, but it seems like
if I hit it then others users will too. Maybe Zhaoyang can try his use
case again with ftrace/core and si_mem_available commented?

IOW I was just helping test the new patch with the si_mem_available
check commented out.

> care? Does the buffer_size_kb updater runs in the same process as any
> large memory process?

In this Qemu run its just the cat process. At work I use trace-cmd or
atrace neither of which I believe have large memory footprints (AFAIK)

Thanks,

- Joel

      reply	other threads:[~2018-04-05 19:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-04 15:53 Steven Rostedt
2018-04-04 16:00 ` Steven Rostedt
2018-04-04 16:03   ` Joel Fernandes
2018-04-04 16:13     ` Steven Rostedt
2018-04-04 16:18       ` Joel Fernandes
2018-04-04 23:59         ` Joel Fernandes
2018-04-05 13:43           ` Steven Rostedt
2018-04-05 19:57             ` Joel Fernandes
2018-04-05 23:36               ` Joel Fernandes
2018-04-06  7:16                 ` Zhaoyang Huang
2018-04-05 14:51           ` Michal Hocko
2018-04-05 19:47             ` Joel Fernandes [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='CAJWu+ooQfN-5tzdEm6=4qTZcvFK+g2GMfX59_9-xkMvwmAk1Rg@mail.gmail.com' \
    --to=joelaf@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=huangzhaoyang@gmail.com \
    --cc=kernel-patch-test@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=vbabka@suse.cz \
    /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