[lkml]   [2018]   [Apr]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] ring-buffer: Add set/clear_current_oom_origin() during allocations
Hi Steve,

On Wed, Apr 4, 2018 at 9:18 AM, Joel Fernandes <> wrote:
> On Wed, Apr 4, 2018 at 9:13 AM, Steven Rostedt <> 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# 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
bash: echo: write error: Cannot allocate memory
[1]+ Killed ./m -m 1M

As you can see, OOM killer triggers and kills "m" which is my busy
memory allocator (it allocates and frees lots of memory and does that
in a loop)

Here's the m program, sorry if it looks too ugly:

Happy to try anything else, BTW when the si_mem_available check
enabled, this doesn't happen and the buffer_size_kb write fails
normally without hurting anything else.

- Joel

 \ /
  Last update: 2018-04-05 02:00    [W:0.097 / U:2.332 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site