[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BYAPR11MB309506F9C8C5814583903048D9919@BYAPR11MB3095.namprd11.prod.outlook.com>
Date: Wed, 10 Mar 2021 01:35:15 +0000
From: "Chen, Mike Ximing" <mike.ximing.chen@...el.com>
To: Greg KH <gregkh@...uxfoundation.org>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"davem@...emloft.net" <davem@...emloft.net>,
"kuba@...nel.org" <kuba@...nel.org>,
"arnd@...db.de" <arnd@...db.de>,
"Williams, Dan J" <dan.j.williams@...el.com>,
"pierre-louis.bossart@...ux.intel.com"
<pierre-louis.bossart@...ux.intel.com>,
Gage Eads <gage.eads@...el.com>
Subject: RE: [PATCH v10 05/20] dlb: add scheduling domain configuration
> -----Original Message-----
> From: Greg KH <gregkh@...uxfoundation.org>
>
> On Wed, Feb 10, 2021 at 11:54:08AM -0600, Mike Ximing Chen wrote:
> > +static inline int dlb_bitmap_clear_range(struct dlb_bitmap *bitmap,
> > + unsigned int bit,
> > + unsigned int len)
> > +{
> > + if (!bitmap || !bitmap->map)
> > + return -EINVAL;
> > +
> > + if (bitmap->len <= bit)
> > + return -EINVAL;
> > +
> > + bitmap_clear(bitmap->map, bit, len);
> > +
> > + return 0;
> > +}
>
> Why isn't logic like this just added to the lib/bitmap.c file?
>
> > +static inline int dlb_bitmap_find_set_bit_range(struct dlb_bitmap *bitmap,
> > + unsigned int len)
> > +{
> > + struct dlb_bitmap *complement_mask = NULL;
> > + int ret;
> > +
> > + if (!bitmap || !bitmap->map || len == 0)
> > + return -EINVAL;
> > +
> > + if (bitmap->len < len)
> > + return -ENOENT;
> > +
> > + ret = dlb_bitmap_alloc(&complement_mask, bitmap->len);
> > + if (ret)
> > + return ret;
> > +
> > + bitmap_zero(complement_mask->map, complement_mask->len);
> > +
> > + bitmap_complement(complement_mask->map, bitmap->map, bitmap->len);
> > +
> > + ret = bitmap_find_next_zero_area(complement_mask->map,
> > + complement_mask->len,
> > + 0,
> > + len,
> > + 0);
> > +
> > + dlb_bitmap_free(complement_mask);
> > +
> > + /* No set bit range of length len? */
> > + return (ret >= (int)bitmap->len) ? -ENOENT : ret;
> > +}
>
> Same here, why not put this in the core kernel instead of a tiny random
> driver like this?
>
OK, we will put them in include/Linux/bitmap.h.
Thanks
Mike
Powered by blists - more mailing lists