On Jul 11, 2011, at 8:36 AM, dtrace-discuss-requ...@opensolaris.org wrote:

> From: Jim Mauro <james.ma...@oracle.com>

> You/we can not make any guarantees to the customer that a given DTrace script
> will never run out of space for dynamic variables (thread-local variables,
> associative array variables). There are things that can be done to minimize
> the possibility of dynamic variable drops;
> 1. Clear unused dynamic variables in the D by assigning a value of zero.
> 2. Increase the space allocated for dynamic variables. Default is 1MB.
>       #pragma D option dynvarsize=2m

Jim, are you saying that if a script has a small upper bound on the number of 
active dynamic variables, DTrace may still run out of dynamic variable space?  
Because that certainly is, if not a bug, very surprising behavior [note: I 
wrote this before I found the undocumented information about cleanrate 
mentioned below].

The script provided looks entirely reasonable.  It uses one thread-local 
variable which is set in sched:::on-cpu and cleared in sched:::off-cpu.  
Honestly, the only way I can imagine this growing beyond the number of hardware 
contexts is if there is a problem with the assumption that every thread that 
fires on-cpu also fires off-cpu.  And if that's the case, I would indeed call 
that a bug.

The script doesn't do anything that isn't in several examples in the DTrace 
documentation.  There's no reason I can see that it should consume dynamic 
variable space if everything is working correctly.  The user's expectations are 
reasonable to an experienced DTrace user.

Scott, your customer's message did not include the exact complaint from dtrace. 
 In particular, it didn't say whether the dynamic variable drops warning 
included "with non-empty dirty list".  If it did, then the problem may be that 
heavy load results in so many threads being scheduled in a short time that the 
asynchronous dynamic variable reaper can't keep up with all the thread-local 
variables.  Increasing the frequency of the cleanrate tunable may help with 
this problem (as described in slide 23 
<http://blogs.oracle.com/bmc/resource/dtrace_tips.pdf>).  This information is 
(still) not documented outside of a slide deck and the not-free book, so you 
may want to add an entry to CR 6221632.

joe

_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to