I was hoping for some feedback regarding the use of BUG(). I have
been experimenting with the patch - changing various bitmasks to
use this new datatype. None of them do the error checking that I am
adding. Is it worth the overhead to have these checks at all? If
they ever trigger, they are indicative of an error elsewhere in the
kernel...
With respect to the for loops: For CPUMAP_SIZE > 1, most of the
interfaces expand to a "for loop". This is a performance vs. bloat
tradeoff. The "for-loop" versions of the functions _could_ be moved
to a cpumap.c file under lib. Is this the recommended approach?
The cpumap_format() function below is probably the worst offender.
There is no real performance value in making it an inline function...
>
> > +static inline char *cpumap_format(cpumap_t map, char *buf, int size)
> > +{
> > + if (size < CPUMAP_BUFSIZE) {
> > + BUG();
> > + }
> > +
> > +#if CPUMAP_SIZE > 1
> > + sprintf(buf, "0x" CPUMAP_FORMAT_STR, map[CPUMAP_SIZE-1]);
> > + {
> > + int i;
> > + char *p = buf + strlen(buf);
> > + for (i = CPUMAP_SIZE-2; i >= 0; i--, p += (sizeof(long) + 1)) {
> > + sprintf(p, " " CPUMAP_FORMAT_STR, map[i]);
> > + }
> > + }
> > +#else
> > + sprintf(buf, "0x" CPUMAP_FORMAT_STR, map[0]);
> > +#endif
> > + return(buf);
> > +}
> --
> vda
-- Russ Weight (rweight@us.ibm.com) Linux Technology Center - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/