PERFORCE change 99099 for review

John Baldwin jhb at freebsd.org
Tue Jun 13 13:34:39 UTC 2006


On Monday 12 June 2006 20:47, John Birrell wrote:
> http://perforce.freebsd.org/chv.cgi?CH=99099
> 
> Change 99099 by jb at jb_freebsd2 on 2006/06/13 00:47:28
> 
> 	Add hooks for DTrace to register a function to be called when
> 	the scheduler chooses a new thread to run. This is required for
> 	DTrace vtime.

You should probably do this in mi_switch() in kern_synch.c rather than
in this macro.

> Affected files ...
> 
> .. //depot/projects/dtrace/src/sys/kern/kern_switch.c#3 edit
> .. //depot/projects/dtrace/src/sys/sys/proc.h#6 edit
> 
> Differences ...
> 
> ==== //depot/projects/dtrace/src/sys/kern/kern_switch.c#3 (text+ko) ====
> 
> @@ -88,6 +88,7 @@
>  #include <sys/cdefs.h>
>  __FBSDID("$FreeBSD: src/sys/kern/kern_switch.c,v 1.121 2006/06/01 22:45:56 cognet Exp $");
>  
> +#include "opt_kdtrace.h"
>  #include "opt_sched.h"
>  
>  #ifndef KERN_SWITCH_INCLUDE
> @@ -126,6 +127,11 @@
>  
>  #define td_kse td_sched
>  
> +#ifdef KDTRACE
> +int	dtrace_vtime_active;
> +dtrace_vtime_switch_func_t	dtrace_vtime_switch_func;
> +#endif
> +
>  /*
>   * kern.sched.preemption allows user space to determine if preemption support
>   * is compiled in or not.  It is not currently a boot or runtime flag that
> 
> ==== //depot/projects/dtrace/src/sys/sys/proc.h#6 (text+ko) ====
> 
> @@ -484,7 +484,17 @@
>  #define	TD_CLR_SUSPENDED(td)	TD_CLR_INHIB((td), TDI_SUSPENDED)
>  #define	TD_CLR_IWAIT(td)	TD_CLR_INHIB((td), TDI_IWAIT)
>  
> +#ifdef KDTRACE
> +typedef	void (*dtrace_vtime_switch_func_t)(struct thread *);
> +
> +extern int			dtrace_vtime_active;
> +extern dtrace_vtime_switch_func_t	dtrace_vtime_switch_func;
> +#define	TD_SET_RUNNING(td)	if (dtrace_vtime_active) \
> +				    (*dtrace_vtime_switch_func)(td); \
> +				(td)->td_state = TDS_RUNNING
> +#else
>  #define	TD_SET_RUNNING(td)	(td)->td_state = TDS_RUNNING
> +#endif
>  #define	TD_SET_RUNQ(td)		(td)->td_state = TDS_RUNQ
>  #define	TD_SET_CAN_RUN(td)	(td)->td_state = TDS_CAN_RUN
>  
> 

-- 
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