PERFORCE change 95987 for review

John Baldwin jhb at freebsd.org
Mon Apr 24 12:41:09 UTC 2006


On Sunday 23 April 2006 11:53 pm, John Birrell wrote:
> http://perforce.freebsd.org/chv.cgi?CH=95987
>
> Change 95987 by jb at jb_freebsd2 on 2006/04/24 03:52:59
>
> 	Just allocate buffer memory for the maximum number of cpus.
>
> Affected files ...
>
> .. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_buffer.c#3 edit
>
> Differences ...
>
> ==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_buffer.c#3
> (text+ko) ====
>
> @@ -69,8 +69,7 @@
>  dtrace_buffer_alloc(dtrace_buffer_t *bufs, size_t size, int flags,
>      processorid_t cpu)
>  {
> -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
> -#ifdef DOODAD
> +#if defined(sun)
>  	cpu_t *cp;
>  	dtrace_buffer_t *buf;
>
> @@ -142,9 +141,51 @@
>  		buf->dtb_xamot = NULL;
>  		buf->dtb_size = 0;
>  	} while ((cp = cp->cpu_next) != cpu_list);
> -#endif
>
>  	return (ENOMEM);
> +#else
> +	dtrace_buffer_t *buf;
> +	int i;
> +
> +	ASSERT(MUTEX_HELD(&dtrace_lock));
> +	for (i = 0; i < mp_ncpus; i++) {

Use mp_maxid rather than mp_ncpus.  CPU ID's in FreeBSD are allowed to be
sparse, but will be in the range 0 .. mp_maxid.

-- 
John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org


More information about the p4-projects mailing list