lkml.org 
[lkml]   [2018]   [Jul]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 2/2] bitmap: sync tools with new bitmap allocation API
On Wed, Jul 04, 2018 at 03:36:17PM +0000, Dmitry Torokhov wrote:

SNIP

> > > > diff --git a/tools/include/linux/bitmap.h b/tools/include/linux/bitmap.h
> > > > index 48c208437bbd..b9b85b94c937 100644
> > > > --- a/tools/include/linux/bitmap.h
> > > > +++ b/tools/include/linux/bitmap.h
> > > > @@ -98,12 +98,23 @@ static inline int test_and_set_bit(int nr, unsigned long *addr)
> > > > }
> > > >
> > > > /**
> > > > - * bitmap_alloc - Allocate bitmap
> > > > - * @nbits: Number of bits
> > > > + * Allocation and deallocation of bitmap.
> > > > */
> > > > -static inline unsigned long *bitmap_alloc(int nbits)
> > > > +static inline unsigned long *bitmap_alloc(unsigned int nbits, gfp_t flags)
> > >
> > > This makes absolutely no sense for userspace API. What gfp_t even means
> > > here?
> > >
> > > If you want to introduce bitmap_zalloc and bitmap_free it is fine but
> > > adding dummy parameters to match kernel API exactly is a folly.
> >
> > Identical API makes easier porting the code from kernel to tools.
> > Refer for example declaration of kmalloc in:
> > tools/testing/radix-tree/linux.c
> > tools/testing/scatterlist/linux/mm.h
> > tools/virtio/linux/kernel.h
> > tools/virtio/ringtest/ptr_ring.c
>
> These are unittests for the APIs in question, of course they would have
> to match exactly.
>
> perf tool however is not a unittest, so there is no need to match kernel
> API.

+1, please remove that flags argument

thanks,
jirka

\
 
 \ /
  Last update: 2018-07-04 19:24    [W:0.074 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site