From: Joel Fernandes <joelaf@google.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Michal Hocko <mhocko@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: Wed, 4 Apr 2018 09:03:47 -0700 [thread overview]
Message-ID: <CAJWu+orC-1JDYHDTQU+DFckGq5ZnXBCCq9wLG-gNK0Nc4-vo7w@mail.gmail.com> (raw)
In-Reply-To: <20180404120002.6561a5bc@gandalf.local.home>
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
next prev parent reply other threads:[~2018-04-04 16:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-04 15:53 [PATCH] ring-buffer: Add set/clear_current_oom_origin() during allocations Steven Rostedt
2018-04-04 16:00 ` Steven Rostedt
2018-04-04 16:03 ` Joel Fernandes [this message]
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
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+orC-1JDYHDTQU+DFckGq5ZnXBCCq9wLG-gNK0Nc4-vo7w@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;
as well as URLs for NNTP newsgroup(s).