Kernel Monitor?

Andrey Simonenko simon at comsys.ntu-kpi.kiev.ua
Mon Feb 14 06:45:01 PST 2005


On Mon, Feb 14, 2005 at 12:28:47AM -0800, Ashwin Chandra wrote:

>   FOREACH_PROC_IN_SYSTEM(p) {
>     mtx_lock(&Giant);
>     PROC_LOCK(p);
>     printf("%d %d\n", (int)p->p_stats->p_ru.ru_isrss, (int)p->p_stats->p_ru.ru_idrss);
>     PROC_UNLOCK(p);
>     mtx_unlock(&Giant);
>   }

Addition to my previous letter.  I'm not sure about Giant, but statclock()
is the only one place where ru_isrss and ru_idrss are modified, so I
think it should be enough to get sched_lock before fetching ru_isrss
and ru_idrss.  Also check locks in getrusage().


More information about the freebsd-hackers mailing list