[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGWkznE_ff0mf+=+5KjKXJmavw9pv2+1+d4_ktYpjsg4ugGOwA@mail.gmail.com>
Date: Mon, 2 Apr 2018 08:52:49 +0800
From: Zhaoyang Huang <huangzhaoyang@...il.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Matthew Wilcox <willy@...radead.org>,
Ingo Molnar <mingo@...nel.org>, linux-kernel@...r.kernel.org,
kernel-patch-test@...ts.linaro.org,
Andrew Morton <akpm@...ux-foundation.org>,
Joel Fernandes <joelaf@...gle.com>,
Michal Hocko <mhocko@...e.com>, linux-mm@...ck.org,
Vlastimil Babka <vbabka@...e.cz>,
Michal Hocko <mhocko@...nel.org>
Subject: Re: [PATCH v1] kernel/trace:check the val against the available mem
On Sat, Mar 31, 2018 at 5:42 AM, Steven Rostedt <rostedt@...dmis.org> wrote:
> On Fri, 30 Mar 2018 17:30:31 -0400
> Steven Rostedt <rostedt@...dmis.org> wrote:
>
>> I'll take a look at si_mem_available() that Joel suggested and see if
>> we can make that work.
>
> Wow, this appears to work great! Joel and Zhaoyang, can you test this?
>
> -- Steve
>
> diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
> index a2fd3893cc02..32a803626ee2 100644
> --- a/kernel/trace/ring_buffer.c
> +++ b/kernel/trace/ring_buffer.c
> @@ -1164,6 +1164,11 @@ static int __rb_allocate_pages(long nr_pages, struct list_head *pages, int cpu)
> struct buffer_page *bpage, *tmp;
> long i;
>
> + /* Check if the available memory is there first */
> + i = si_mem_available();
> + if (i < nr_pages)
> + return -ENOMEM;
> +
> for (i = 0; i < nr_pages; i++) {
> struct page *page;
> /*
Hi Steve, It works as my previous patch does.
Powered by blists - more mailing lists