I am writing some code that will be called from the function ts_tick(), which is called by clock_tick(). Comments in ts_tick() say that when one releases a thread lock s/he should use "thread_unlock_nopreempt()" since "clock thread cannot be pre-empted". (See http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/disp/ts.c, line 1781).
My question is, if my code is called from ts_tick(), can I not acquire any adaptive mutexes? I thought that I cannot use MUTEX_ADAPTIVE (MUTEX_DEFAULT) mutex, because it might block, and, according to those comments, the thread executing clock_tick cannot be blocked. So I was going to use MUTEX_SPIN. And then, I went through clock_tick_process(), a function that calls clock_tick() (see http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/os/clock_tick.c) and saw that it acquires an adaptive mutex: 367 plockp = t->t_plockp; 368 mutex_enter(plockp); I haven't found any place where plockp (or the p_lock mutex to which it points) was initialized, so I assume it's adaptive. Could you please shed some light on this issue? Is it safe to use an adaptive mutex in the code called from clock_tick? If not, then which interrupt level should I use upon initializing the mutex of type MUTEX_SPIN? And what kind of mutex is p_lock? Thanks! This message posted from opensolaris.org _______________________________________________ opensolaris-code mailing list opensolaris-code@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/opensolaris-code