pcp
[Top] [All Lists]

Re: [pcp] Hotproc fixes

To: Martins Innus <minnus@xxxxxxxxxxx>
Subject: Re: [pcp] Hotproc fixes
From: Nathan Scott <nathans@xxxxxxxxxx>
Date: Thu, 23 Apr 2015 23:41:16 -0400 (EDT)
Cc: myllynen@xxxxxxxxxx, pcp@xxxxxxxxxxx
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <55392BAB.3060101@xxxxxxxxxxx>
References: <5536A934.8040002@xxxxxxxxxxx> <5537A154.2090803@xxxxxxxxxx> <5537A3F3.5060204@xxxxxxxxxxx> <233739221.5258413.1429764654377.JavaMail.zimbra@xxxxxxxxxx> <55392BAB.3060101@xxxxxxxxxxx>
Reply-to: Nathan Scott <nathans@xxxxxxxxxx>
Thread-index: X/bnlyTevGGYePUgB/0QaF4BWLgxKg==
Thread-topic: Hotproc fixes

----- Original Message -----
> [...]
> OK, tracked this down.  Only happens on some OSs.  I had assumed that
> all of /proc/<pid>/* should be available and files would only be missing
> if some badness happened or a pid was in the process of exiting.  Turns
> out that schedstat is not enabled in some kernels by default.  Will need
> a bit of rework to deal with this.

Now that I think about it, the /proc/pid/io entry is in the same boat...
the kernel fs/proc/base.c code has -

#ifdef CONFIG_TASK_IO_ACCOUNTING
        ONE("io",       S_IRUSR, proc_tgid_io_accounting),
#endif

and it was only added part way through 2.6 lifetime IIRC, so older kernels
will not have it at all.  status and stat should be pretty safe though, so
this should probably change too...?

diff --git a/src/pmdas/linux_proc/proc_pid.c b/src/pmdas/linux_proc/proc_pid.c
index 2dff249..5232367 100644
--- a/src/pmdas/linux_proc/proc_pid.c
+++ b/src/pmdas/linux_proc/proc_pid.c
@@ -487,7 +487,8 @@ hotproc_eval_procs(void)
        ioentry = fetch_proc_pid_io(pid, hotproc_poss_pid, &sts);
        schedstatentry = fetch_proc_pid_schedstat(pid, hotproc_poss_pid, &sts);
 
-       if (!statentry || !statusentry || !ioentry /*|| !schedstatentry */ ) { 
/* schedstat not available everywhere */
+        /* Note: /proc/pid/schedstat and /proc/pid/io not on all platforms */
+       if (!statentry || !statusentry /*|| !ioentry || !schedstatentry */) {
            /* Can happen if the process was exiting during
             * refresh_proc_pidlist then the above fetch's will fail.


cheers.

--
Nathan

<Prev in Thread] Current Thread [Next in Thread>