Subject: Re: workqueue(9), per-CPU queues (part 2)
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Andrew Doran <ad@netbsd.org>
List: tech-kern
Date: 07/26/2007 10:33:16
On Wed, Jul 25, 2007 at 09:14:10PM +0900, YAMAMOTO Takashi wrote:

> - how about:
> 	#if defined(MULTIPROCESSOR)
> 	#define	WQ_CACHE_LINE_SIZE	CACHE_LINE_SIZE
> 	#else /* defined(MULTIPROCESSOR) */
> 	#define	WQ_CACHE_LINE_SIZE	(ALIGNBYTES + 1)
> 	#endif /* defined(MULTIPROCESSOR) */

Personally I prefer to avoid ifdefs like this, but of course you may prefer
otherwise. On your average system we'll save a few bytes here and there, it
hardly seems worth it. Similarly:

> #ifdef MULTIPROCESSOR
>        i = (flags & WQ_PERCPU) ? ncpu : 1;
> #else
>        i = 1;
>        flags &= ~WQ_PERCPU;
> #endif

Can that be coded so that the ifdef is unneeded?

Andrew