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

Reply via email to