lkml.org 
[lkml]   [2019]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] perf/core: don't WARN for impossible rb sizes
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)


\
 
 \ /
  Last update: 2019-02-12 14:09    [W:0.055 / U:1.216 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site