I want to find swapped threads and a article on the internet suggested use the following command:
echo "::walk thread thr |::print kthread_t t_schedflag|::grep .==0 |::eval <thr=K|::print kthread_t t_procp->p_user.u_comm" | mdb -k
the command find for threads whose t_schedflag = 0.
but in /usr/include/sys/thread.h, the values of t_schedflag are defined as below:
#define TS_LOAD 0x0001 /* thread is in memory */
#define TS_DONT_SWAP 0x0002 /* thread/lwp should not be swapped */
#define TS_SWAPENQ 0x0004 /* swap thread when it reaches a safe point */
#define TS_ON_SWAPQ 0x0008 /* thread is on the swap queue */
#define TS_SIGNALLED 0x0010 /* thread was awakened by cv_signal() */
#define TS_PROJWAITQ 0x0020 /* thread is on its project's waitq */
#define TS_ZONEWAITQ 0x0040 /* thread is on its zone's waitq */
#define TS_CSTART 0x0100 /* setrun() by continuelwps() */
#define TS_UNPAUSE 0x0200 /* setrun() by unpauselwps() */
#define TS_XSTART 0x0400 /* setrun() by SIGCONT */
#define TS_PSTART 0x0800 /* setrun() by /proc */
#define TS_RESUME 0x1000 /* setrun() by CPR resume process */
#define TS_CREATE 0x2000 /* setrun() by syslwp_create() */
#define TS_RUNQMATCH 0x4000 /* exact run queue balancing by setbackdq() */
#define TS_ALLSTART \
#define TS_ANYWAITQ (TS_PROJWAITQ|TS_ZONEWAITQ)
the value 0x0000 is not defined.
Can anyone explain the validity of the use of ::grep .==0 in the above command?
Thanks in advance.
I can not explain the use 0 but it does fix what I am seeing today on:
SunOS rizzotest 5.10 Generic_142900-11 sun4v sparc SUNW,SPARC-Enterprise-T5220
Solaris 10 10/09 s10s_u8wos_08a SPARC
Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
Use is subject to license terms.
Assembled 16 September 2009
1009494.1 shows using 8 but this does not work for me.
Edited by: gleng on Aug 24, 2011 9:00 AM
gleng wrote 24-Aug-11:
I can not explain the use 0 but it does fix what I am seeing today
That original post has a November 2009 date on it.
That is the date it was migrated from the Supportforum-dot-Sun-dot-Com site to the Forums-dot-Sun-dot-Com site. The actual posting date is lost to pre-history.
The original person never re-registered for that second site, let alone for the Oracle forums, thus the username is a generic one.
Your reply has value but the original post is far too separated to ever have it get back to them.
- Moderator Action:
This thread is now locked so that it doesn't get re-resurrected.