From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: Re: [PATCH v3 3/5] bitmap: Add bitmap_alloc(), bitmap_zalloc() and bitmap_free() Date: Mon, 18 Jun 2018 16:10:56 -0700 Message-ID: <20180618161056.e52efd0e8bd36211e60705a2@linux-foundation.org> References: <20180618131003.88110-1-andriy.shevchenko@linux.intel.com> <20180618131003.88110-4-andriy.shevchenko@linux.intel.com> <20180618141404.68124daab97bd0f3a3051544@linux-foundation.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Dmitry Torokhov Cc: Andy Shevchenko , agk@redhat.com, Mike Snitzer , device-mapper development , shli@kernel.org, linux-raid@vger.kernel.org, "linux-input@vger.kernel.org" , ynorov@caviumnetworks.com, lkml , Mika Westerberg , Joe Perches List-Id: linux-raid.ids On Mon, 18 Jun 2018 15:01:43 -0700 Dmitry Torokhov wrote: > > > +unsigned long *bitmap_alloc(unsigned int nbits, gfp_t flags) > > > +{ > > > + return kmalloc_array(BITS_TO_LONGS(nbits), sizeof(unsigned long), flags); > > > +} > > > +EXPORT_SYMBOL(bitmap_alloc); > > > + > > > +unsigned long *bitmap_zalloc(unsigned int nbits, gfp_t flags) > > > +{ > > > + return bitmap_alloc(nbits, flags | __GFP_ZERO); > > > +} > > > +EXPORT_SYMBOL(bitmap_zalloc); > > > + > > > +void bitmap_free(const unsigned long *bitmap) > > > +{ > > > + kfree(bitmap); > > > +} > > > +EXPORT_SYMBOL(bitmap_free); > > > + > > > > I suggest these functions are small and simple enough to justify > > inlining them. > > > > We can't as we end up including bitmap.h (by the way of cpumask.h) > form slab.h, so we gen circular dependency. That info should have been in the changelog, and probably a code comment. > Maybe if we removed memcg > stuff from slab.h so we do not need to include workqueue.h... Or move the basic slab API stuff out of slab.h into a new header. Or create a new, standalone work_struct.h - that looks pretty simple.