lkml.org 
[lkml]   [2018]   [Apr]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] ring-buffer: Add set/clear_current_oom_origin() during allocations
On Wed, Apr 4, 2018 at 9:00 AM, Steven Rostedt <rostedt@goodmis.org> wrote:
> On Wed, 4 Apr 2018 11:53:10 -0400
> Steven Rostedt <rostedt@goodmis.org> wrote:
>
>> @@ -1162,35 +1163,60 @@ static int rb_check_pages(struct ring_buffer_per_cpu *cpu_buffer)
>> static int __rb_allocate_pages(long nr_pages, struct list_head *pages, int cpu)
>> {
>> struct buffer_page *bpage, *tmp;
>> + bool user_thread = current->mm != NULL;
>> + gfp_t mflags;
>> long i;
>>
>> - /* Check if the available memory is there first */
>> + /*
>> + * Check if the available memory is there first.
>> + * Note, si_mem_available() only gives us a rough estimate of available
>> + * memory. It may not be accurate. But we don't care, we just want
>> + * to prevent doing any allocation when it is obvious that it is
>> + * not going to succeed.
>> + */
>
> In case you are wondering how I tested this, I simply added:
>
> #if 0
>> i = si_mem_available();
>> if (i < nr_pages)
>> return -ENOMEM;
> #endif
>
> for the tests. Note, without this, I tried to allocate all memory
> (bisecting it with allocations that failed and allocations that
> succeeded), and couldn't trigger an OOM :-/

I guess you need to have something *else* other than the write to
buffer_size_kb doing the GFP_KERNEL allocations but unfortunately gets
OOM killed?

Also, I agree with the new patch and its nice idea to do that.

thanks,

- Joel

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