From b939335607b60b588976285a1823bc51ec7ce82e Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Wed, 24 Jan 2001 11:20:05 +0000 Subject: [PATCH] - Catch up to proc flag changes. --- sys/fs/procfs/procfs_status.c | 8 ++++++-- sys/miscfs/procfs/procfs_status.c | 8 ++++++-- sys/vm/vm_fault.c | 4 +++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/sys/fs/procfs/procfs_status.c b/sys/fs/procfs/procfs_status.c index d7dd108be9fa..813ad60fc0de 100644 --- a/sys/fs/procfs/procfs_status.c +++ b/sys/fs/procfs/procfs_status.c @@ -123,19 +123,23 @@ procfs_dostatus(curp, p, pfs, uio) DOCHECK(); } - if (p->p_flag & P_INMEM) { + mtx_enter(&sched_lock, MTX_SPIN); + if (p->p_sflag & PS_INMEM) { struct timeval ut, st; calcru(p, &ut, &st, (struct timeval *) NULL); + mtx_exit(&sched_lock, MTX_SPIN); ps += snprintf(ps, psbuf + sizeof(psbuf) - ps, " %ld,%ld %ld,%ld %ld,%ld", p->p_stats->p_start.tv_sec, p->p_stats->p_start.tv_usec, ut.tv_sec, ut.tv_usec, st.tv_sec, st.tv_usec); - } else + } else { + mtx_exit(&sched_lock, MTX_SPIN); ps += snprintf(ps, psbuf + sizeof(psbuf) - ps, " -1,-1 -1,-1 -1,-1"); + } DOCHECK(); ps += snprintf(ps, psbuf + sizeof(psbuf) - ps, " %s", diff --git a/sys/miscfs/procfs/procfs_status.c b/sys/miscfs/procfs/procfs_status.c index d7dd108be9fa..813ad60fc0de 100644 --- a/sys/miscfs/procfs/procfs_status.c +++ b/sys/miscfs/procfs/procfs_status.c @@ -123,19 +123,23 @@ procfs_dostatus(curp, p, pfs, uio) DOCHECK(); } - if (p->p_flag & P_INMEM) { + mtx_enter(&sched_lock, MTX_SPIN); + if (p->p_sflag & PS_INMEM) { struct timeval ut, st; calcru(p, &ut, &st, (struct timeval *) NULL); + mtx_exit(&sched_lock, MTX_SPIN); ps += snprintf(ps, psbuf + sizeof(psbuf) - ps, " %ld,%ld %ld,%ld %ld,%ld", p->p_stats->p_start.tv_sec, p->p_stats->p_start.tv_usec, ut.tv_sec, ut.tv_usec, st.tv_sec, st.tv_usec); - } else + } else { + mtx_exit(&sched_lock, MTX_SPIN); ps += snprintf(ps, psbuf + sizeof(psbuf) - ps, " -1,-1 -1,-1 -1,-1"); + } DOCHECK(); ps += snprintf(ps, psbuf + sizeof(psbuf) - ps, " %s", diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index 686647e5ebc4..ee30759f526f 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -854,13 +854,15 @@ RetryFault:; vm_page_activate(fs.m); } - if (curproc && (curproc->p_flag & P_INMEM) && curproc->p_stats) { + mtx_enter(&sched_lock, MTX_SPIN); + if (curproc && (curproc->p_sflag & PS_INMEM) && curproc->p_stats) { if (hardfault) { curproc->p_stats->p_ru.ru_majflt++; } else { curproc->p_stats->p_ru.ru_minflt++; } } + mtx_exit(&sched_lock, MTX_SPIN); /* * Unlock everything, and return