latch相關一些資料

jixuewen發表於2007-11-16

latch instance structure
struct ksllt {
union ksllt.kslltlat kslltlat;
eword kslltlvl; /* latch level, to enforce hierarchy */
ub2 kslltnum; /* latch number, to index descriptors */
uword kslltwhr; /* the context from where the latch is held */
ubig_ora kslltwhy; /* why the latch is being acquired */
ub4 kslltwgt; /* count of times gotten wait */
ub4 kslltngt; /* count of times gotten nowait */
eword kslltefd; /* error frame depth when gotten, this is used to */
ub4 kslltwff; /* count of wait gets that failed first try */
ub4 kslltnfa; /* count of times failed nowait get */
ub4 kslltntg; /* count of total gets of latch */
ub4 kslltwts; /* number of waiters */
ub4 ksllttmr; /* down/hold time timer */
kstat kslltwtt; /* wait time for this latch */
kstat ksllthdt; /* hold time for this latch */
kstat kslltdnt; /* down time for this latch */
kstat kslltwtw; /* wait time for associated wait list latch */
ub4 kslltwxs; /* count of X process waiting because of S holders */
ub4 kslltwsx; /* count of S process waiting because of X holder */
ub4 kslltwsw; /* count of S process waiting because of X waiter */
ub4 kslltmxs; /* X misses owing to S holders */
ub4 kslltmsx; /* S misses owing to X holders */
ub4 kslltmxw; /* S misses owing to X waiters */
ub4 kslltwsl; /* count of times slept when failed to get latch */
struct ksllt * kslltchg; /* last child gotten as part of get-parent op */
ub4 kslltwkc; /* count of wakeups that have been done */
ub4 kslltwth; /* count of sleeps that were holding another latch */
ub4 yields_ksllt; /* count of yields */
BitMask for "struct ksllt.yields_ksllt"
KSLHSTMAX BIT 4 // if you change this, must change x$ table

ub4 ksllthst[4];
ub4 gets_wl_ksllt; /* number of gets of wait list latch */
ub4 misses_wl_ksllt; /* number of misses on wait list latch */
ub4 sleeps_wl_ksllt; /* number of sleeps on wait list latch */
ub4 yields_wl_ksllt; /* number of yields on wait list latch */
struct kslla * waitproc_ksllt; /* log change to wait list */
kgglk waiters_ksllt; /* head of waiter list */
kgglk kslltlnk; /* linked list of children */
void * kslltrec; /* recovery info for this latch */
b1 kslltsp1[3]; /* 1 spare 1 byte field */
uword kslltcnm; /* child number */
uword class_ksllt; /* latch class */
skgslt wl_ksllt;
}


struct kslla {
ksllt * ksllalat[( 8 + 7 )]; /* latches owned at each level */
ksllt * ksllalaq; /* latch being acquired */
ksllt * wl_flux_kslla; /* latch whose wait list I'm acquiring */
ksllt * ksllaxbs; /* EXWAIT bit set in shared latch */
ksllt * ksllawat; /* latch being waited for: not protected by any latch, */
ubig_ora ksllawhy; /* context for the latch req */
uword ksllawere; /* location from where the req is being made */
word ksllaevt; /* event waiting for */
uword ksllalow; /* bit array of latches owned, for levels [0..9] */
ubig_ora ksllaevx; /* extension to the event id ksllaevt */
kgglk waiters_kslla; /* link on waiter list */
struct ksllt * ksllawtr; /* latch waiter list this process is on. */
struct ksllt * ksllaspn; /* latch this process is spinning on */
uword ksllawst; /* process wait state (asleep/awake) */
ub4 ksllamd[( 8 + 7 )]; /* For r/w latches, mode in which latch is held */
uword ksllalpe; /* latch post expected */
kgglk ksllapwl; /* Link in post/wait queue the process is on */
kslpwq * ksllapwq; /* post/wait queue the process is on */
sword ksllapwi; /* Index of p/w queue the process was last on */
krmid ksllapid; /* the res ID for the last post received */
krmid ksllasid; /* the res ID for the last post sent */
uword ksllaprv; /* loc ID for the last post received */
uword ksllapsn; /* loc ID (where) for the last post sent */
ub4 ksllapsc; /* count of # of posts sent by the process */
ub4 ksllaprc; /* count of # of posts received by the process */
struct ksupr * ksllapos; /* the last process to post me */
struct ksupr * ksllalpo; /* the last process posted by me */
kgslfx ksllafac; /* context for wait/post facilities */
uword ksllawrk; /* is there work for a process about to be posted */
ub2 ksllasfa; /* service managed wait facility */
BitMask for "struct kslla.ksllasfa"
KSLLASFA_IO BIT 0x0001 // ksfd I/O pending
KSLLASFA_IPC BIT 0x0002 // ksxp I/O pending

}


struct kslld {
text * kslldnam; /* human-readable latch name */
void (*kslldcln); /* _ sword action, ksllt *lp _ cleanup proc*/
void (*kslldgcl); /* _ kgsmp *gp, sword action, struct kgslt *lp _ */
size_t kslldrsz; /* recovery structure size */
b1 kslldlvl; /* latch level */
b1 kslldpnt; /* TRUE if parent of a class of latches */
ub1 kslldlng; /* TRUE if latch can be held for long periods */
b1 kslldg2c; /* parent allowing wait get of 2 children */
uword kslldshl; /* TRUE if latch is shareable */
uword kslldcls; /* latch class */
}

[@more@]從白蟮blog轉載

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/564597/viewspace-982601/,如需轉載,請註明出處,否則將追究法律責任。

相關文章