From 9ac1ee6e1714ea5a239411b06a67199236c5ddda Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Fri, 10 Dec 2010 18:08:20 -0800 Subject: [PATCH] kernel - Set wmesg when spinning on a token or the mplock * When spinning on a token or the mplock set the wmesg so it shows up in ps and top output. --- sys/kern/lwkt_thread.c | 7 +++++++ usr.bin/top/m_dragonfly.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/kern/lwkt_thread.c b/sys/kern/lwkt_thread.c index b22286a3ec..6d32a6b6ac 100644 --- a/sys/kern/lwkt_thread.c +++ b/sys/kern/lwkt_thread.c @@ -803,7 +803,13 @@ lwkt_switch(void) #endif goto havethread; } + + /* + * Thread was runnable but we were unable to get the required + * resources (tokens and/or mplock). + */ #ifdef SMP + ntd->td_wmesg = lmsg; if (ntd->td_fairq_accum >= 0) set_cpu_contention_mask(gd); /* @@ -857,6 +863,7 @@ lwkt_switch(void) havethread: ++gd->gd_cnt.v_swtch; --ntd->td_fairq_accum; + ntd->td_wmesg = NULL; xtd = TAILQ_FIRST(&gd->gd_tdrunq); if (ntd != xtd && ntd->td_pri >= xtd->td_pri) { TAILQ_REMOVE(&gd->gd_tdrunq, ntd, td_threadq); diff --git a/usr.bin/top/m_dragonfly.c b/usr.bin/top/m_dragonfly.c index cbf108d750..f743f78115 100644 --- a/usr.bin/top/m_dragonfly.c +++ b/usr.bin/top/m_dragonfly.c @@ -97,10 +97,10 @@ struct handle { */ static char smp_header[] = -" PID %-*.*s NICE SIZE PRES STATE C TIME CTIME CPU COMMAND"; +" PID %-*.*s NICE SIZE PRES STATE CPU TIME CTIME CPU COMMAND"; #define smp_Proc_format \ - "%5d %-*.*s %3d%7s %6s %7.7s %02d %6s %7s %5.2f%% %.*s" + "%5d %-*.*s %3d%7s %6s %7.7s %2d %6s %7s %5.2f%% %.*s" static char up_header[] = " PID %-*.*s NICE SIZE PRES STATE TIME CTIME CPU COMMAND"; -- 2.41.0