From: Peter Zijlstra <peterz@infradead.org>
To: "Jin, Yao" <yao.jin@linux.intel.com>
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: Tue, 12 Feb 2019 14:07:56 +0100 [thread overview]
Message-ID: <20190212130756.GH32494@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <1f71da66-4783-0108-668c-cdffca499719@linux.intel.com>
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)
next prev parent reply other threads:[~2019-02-12 13:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-10 14:27 [PATCH] perf/core: don't WARN for impossible rb sizes 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 [this message]
2019-02-13 1:40 ` Jin, Yao
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=20190212130756.GH32494@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--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=yao.jin@intel.com \
--cc=yao.jin@linux.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