From: "Jin, Yao" <yao.jin@linux.intel.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
linux-kernel@vger.kernel.org, julien.thierry@arm.com,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Ingo Molnar <mingo@redhat.com>, Jiri Olsa <jolsa@redhat.com>,
Namhyung Kim <namhyung@kernel.org>,
"Jin, Yao" <yao.jin@intel.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>
Subject: Re: [PATCH] perf/core: don't WARN for impossible rb sizes
Date: Wed, 13 Feb 2019 09:40:05 +0800 [thread overview]
Message-ID: <023208e9-4aec-3401-8ec1-6368a01df8f7@linux.intel.com> (raw)
In-Reply-To: <20190212130756.GH32494@hirez.programming.kicks-ass.net>
On 2/12/2019 9:07 PM, Peter Zijlstra wrote:
> On Tue, Feb 12, 2019 at 10:42:38AM +0800, Jin, Yao wrote:
>>> diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
>>> index 4a9937076331..309ef5a64af5 100644
>>> --- a/kernel/events/ring_buffer.c
>>> +++ b/kernel/events/ring_buffer.c
>>> @@ -734,6 +734,9 @@ struct ring_buffer *rb_alloc(int nr_pages, long watermark, int cpu, int flags)
>>> size = sizeof(struct ring_buffer);
>>> size += nr_pages * sizeof(void *);
>>> + if (order_base_2(size) >= MAX_ORDER)
>>> + goto fail;
>>> +
>>> rb = kzalloc(size, GFP_KERNEL);
>
> Yes, Boris also send the entire morning bisecting this.
>
> The problem is that @size is in bytes and MAX_ORDER is in pages.
>
> That should be:
>
> if (order_base_2(size) >= PAGE_SHIFT+MAX_ORDER)
>
>
Thanks Peter! This fix works!
Thanks
Jin Yao
prev parent reply other threads:[~2019-02-13 1:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-10 14:27 Mark Rutland
2019-01-11 9:06 ` Julien Thierry
2019-02-04 8:49 ` [tip:perf/core] perf/core: Don't WARN() for impossible ring-buffer sizes tip-bot for Mark Rutland
2019-02-12 2:42 ` [PATCH] perf/core: don't WARN for impossible rb sizes Jin, Yao
2019-02-12 13:07 ` Peter Zijlstra
2019-02-13 1:40 ` Jin, Yao [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=023208e9-4aec-3401-8ec1-6368a01df8f7@linux.intel.com \
--to=yao.jin@linux.intel.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=julien.thierry@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=yao.jin@intel.com \
/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
Powered by JetHome