Paul Mininni
2010-11-04 18:02:23 UTC
In rw_enter_sleep(),
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/os/rwlock.c#rw_enter_sleep
...
306 sleep_time
<http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/os/rwlock.c#sleep_time>
= -gethrtime <http://src.opensolaris.org/source/s?defs=gethrtime&project=/onnv>();
307 *if* (rw
<http://src.opensolaris.org/source/s?defs=rw&project=/onnv> ==
RW_READER <http://src.opensolaris.org/source/s?defs=RW_READER&project=/onnv>)
{
308 THREAD_KPRI_RELEASE
<http://src.opensolaris.org/source/s?defs=THREAD_KPRI_RELEASE&project=/onnv>();
309 CPU_STATS_ADDQ
<http://src.opensolaris.org/source/s?defs=CPU_STATS_ADDQ&project=/onnv>(CPU
<http://src.opensolaris.org/source/s?defs=CPU&project=/onnv>, sys
<http://src.opensolaris.org/source/s?defs=sys&project=/onnv>,
rw_rdfails <http://src.opensolaris.org/source/s?defs=rw_rdfails&project=/onnv>,
1);
310 (*void*) turnstile_block
<http://src.opensolaris.org/source/s?defs=turnstile_block&project=/onnv>(ts,
TS_READER_Q <http://src.opensolaris.org/source/s?defs=TS_READER_Q&project=/onnv>,
lp,
311 &rw_sobj_ops
<http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/os/rwlock.c#rw_sobj_ops>,
NULL <http://src.opensolaris.org/source/s?defs=NULL&project=/onnv>,
NULL <http://src.opensolaris.org/source/s?defs=NULL&project=/onnv>);
312 } *else* {
313 CPU_STATS_ADDQ
<http://src.opensolaris.org/source/s?defs=CPU_STATS_ADDQ&project=/onnv>(CPU
<http://src.opensolaris.org/source/s?defs=CPU&project=/onnv>, sys
<http://src.opensolaris.org/source/s?defs=sys&project=/onnv>,
rw_wrfails <http://src.opensolaris.org/source/s?defs=rw_wrfails&project=/onnv>,
1);
314 (*void*) turnstile_block
<http://src.opensolaris.org/source/s?defs=turnstile_block&project=/onnv>(ts,
TS_WRITER_Q <http://src.opensolaris.org/source/s?defs=TS_WRITER_Q&project=/onnv>,
lp,
315 &rw_sobj_ops
<http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/os/rwlock.c#rw_sobj_ops>,
NULL <http://src.opensolaris.org/source/s?defs=NULL&project=/onnv>,
NULL <http://src.opensolaris.org/source/s?defs=NULL&project=/onnv>);
316 }
317 sleep_time
<http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/os/rwlock.c#sleep_time>
+= gethrtime <http://src.opensolaris.org/source/s?defs=gethrtime&project=/onnv>();
318
319 LOCKSTAT_RECORD4
<http://src.opensolaris.org/source/s?defs=LOCKSTAT_RECORD4&project=/onnv>(LS_RW_ENTER_BLOCK
<http://src.opensolaris.org/source/s?defs=LS_RW_ENTER_BLOCK&project=/onnv>,
lp, sleep_time <http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/os/rwlock.c#sleep_time>,
rw <http://src.opensolaris.org/source/s?defs=rw&project=/onnv>,
320 (old & RW_WRITE_LOCKED
<http://src.opensolaris.org/source/s?defs=RW_WRITE_LOCKED&project=/onnv>)
? 1 : 0,
321 old >> RW_HOLD_COUNT_SHIFT
<http://src.opensolaris.org/source/s?defs=RW_HOLD_COUNT_SHIFT&project=/onnv>);
...
Wouldn't something like LOCKSTAT_START_TIME be more efficient instead of
calling gethrtime() regardless if the lockstat probe has been enabled or
not?
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/sys/lockstat.h
#*define* LOCKSTAT_START_TIME
<http://src.opensolaris.org/source/s?refs=LOCKSTAT_START_TIME&project=/onnv>(probe
<http://src.opensolaris.org/source/s?defs=probe&project=/onnv>) ( \
lockstat_probemap
<http://src.opensolaris.org/source/s?defs=lockstat_probemap&project=/onnv>[(probe
<http://src.opensolaris.org/source/s?defs=probe&project=/onnv>)] ?
gethrtime_waitfree
<http://src.opensolaris.org/source/s?defs=gethrtime_waitfree&project=/onnv>()
: 0 \
)
Just curious. Thx.
-Paul
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/os/rwlock.c#rw_enter_sleep
...
306 sleep_time
<http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/os/rwlock.c#sleep_time>
= -gethrtime <http://src.opensolaris.org/source/s?defs=gethrtime&project=/onnv>();
307 *if* (rw
<http://src.opensolaris.org/source/s?defs=rw&project=/onnv> ==
RW_READER <http://src.opensolaris.org/source/s?defs=RW_READER&project=/onnv>)
{
308 THREAD_KPRI_RELEASE
<http://src.opensolaris.org/source/s?defs=THREAD_KPRI_RELEASE&project=/onnv>();
309 CPU_STATS_ADDQ
<http://src.opensolaris.org/source/s?defs=CPU_STATS_ADDQ&project=/onnv>(CPU
<http://src.opensolaris.org/source/s?defs=CPU&project=/onnv>, sys
<http://src.opensolaris.org/source/s?defs=sys&project=/onnv>,
rw_rdfails <http://src.opensolaris.org/source/s?defs=rw_rdfails&project=/onnv>,
1);
310 (*void*) turnstile_block
<http://src.opensolaris.org/source/s?defs=turnstile_block&project=/onnv>(ts,
TS_READER_Q <http://src.opensolaris.org/source/s?defs=TS_READER_Q&project=/onnv>,
lp,
311 &rw_sobj_ops
<http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/os/rwlock.c#rw_sobj_ops>,
NULL <http://src.opensolaris.org/source/s?defs=NULL&project=/onnv>,
NULL <http://src.opensolaris.org/source/s?defs=NULL&project=/onnv>);
312 } *else* {
313 CPU_STATS_ADDQ
<http://src.opensolaris.org/source/s?defs=CPU_STATS_ADDQ&project=/onnv>(CPU
<http://src.opensolaris.org/source/s?defs=CPU&project=/onnv>, sys
<http://src.opensolaris.org/source/s?defs=sys&project=/onnv>,
rw_wrfails <http://src.opensolaris.org/source/s?defs=rw_wrfails&project=/onnv>,
1);
314 (*void*) turnstile_block
<http://src.opensolaris.org/source/s?defs=turnstile_block&project=/onnv>(ts,
TS_WRITER_Q <http://src.opensolaris.org/source/s?defs=TS_WRITER_Q&project=/onnv>,
lp,
315 &rw_sobj_ops
<http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/os/rwlock.c#rw_sobj_ops>,
NULL <http://src.opensolaris.org/source/s?defs=NULL&project=/onnv>,
NULL <http://src.opensolaris.org/source/s?defs=NULL&project=/onnv>);
316 }
317 sleep_time
<http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/os/rwlock.c#sleep_time>
+= gethrtime <http://src.opensolaris.org/source/s?defs=gethrtime&project=/onnv>();
318
319 LOCKSTAT_RECORD4
<http://src.opensolaris.org/source/s?defs=LOCKSTAT_RECORD4&project=/onnv>(LS_RW_ENTER_BLOCK
<http://src.opensolaris.org/source/s?defs=LS_RW_ENTER_BLOCK&project=/onnv>,
lp, sleep_time <http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/os/rwlock.c#sleep_time>,
rw <http://src.opensolaris.org/source/s?defs=rw&project=/onnv>,
320 (old & RW_WRITE_LOCKED
<http://src.opensolaris.org/source/s?defs=RW_WRITE_LOCKED&project=/onnv>)
? 1 : 0,
321 old >> RW_HOLD_COUNT_SHIFT
<http://src.opensolaris.org/source/s?defs=RW_HOLD_COUNT_SHIFT&project=/onnv>);
...
Wouldn't something like LOCKSTAT_START_TIME be more efficient instead of
calling gethrtime() regardless if the lockstat probe has been enabled or
not?
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/sys/lockstat.h
#*define* LOCKSTAT_START_TIME
<http://src.opensolaris.org/source/s?refs=LOCKSTAT_START_TIME&project=/onnv>(probe
<http://src.opensolaris.org/source/s?defs=probe&project=/onnv>) ( \
lockstat_probemap
<http://src.opensolaris.org/source/s?defs=lockstat_probemap&project=/onnv>[(probe
<http://src.opensolaris.org/source/s?defs=probe&project=/onnv>)] ?
gethrtime_waitfree
<http://src.opensolaris.org/source/s?defs=gethrtime_waitfree&project=/onnv>()
: 0 \
)
Just curious. Thx.
-Paul