aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/sched_4bsd.c
diff options
context:
space:
mode:
authorDavid Xu <davidxu@FreeBSD.org>2003-11-08 03:03:17 +0000
committerDavid Xu <davidxu@FreeBSD.org>2003-11-08 03:03:17 +0000
commit685a6c448ab93d51023dedc385a5bd08338fb02c (patch)
tree50781b4beb35c3c3eb9418d8968256834a8dd96f /sys/kern/sched_4bsd.c
parente31d6d81497ab0ad8ea3d926a7946f984ea76984 (diff)
downloadsrc-685a6c448ab93d51023dedc385a5bd08338fb02c.tar.gz
src-685a6c448ab93d51023dedc385a5bd08338fb02c.zip
Return a reasonable number for top or ps to display for M:N thread,
since there is no direct association between M:N thread and kse, sometimes, a thread does not have a kse, in that case, return a pctcpu from its last kse, it is not perfect, but gives a good number to be displayed.
Notes
Notes: svn path=/head/; revision=122286
Diffstat (limited to 'sys/kern/sched_4bsd.c')
-rw-r--r--sys/kern/sched_4bsd.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c
index 1a2315737405..be4b16ae5d74 100644
--- a/sys/kern/sched_4bsd.c
+++ b/sys/kern/sched_4bsd.c
@@ -723,6 +723,8 @@ sched_pctcpu(struct thread *td)
struct kse *ke;
ke = td->td_kse;
+ if (ke == NULL)
+ ke = td->td_last_kse;
if (ke)
return (ke->ke_pctcpu);