]> Zhao Yanbai Git Server - minix.git/commitdiff
getrusage(2): zero out ru_i[xds]rss fields 00/3200/1
authorDavid van Moolenbroek <david@minix3.org>
Sun, 27 Sep 2015 11:28:56 +0000 (11:28 +0000)
committerDavid van Moolenbroek <david@minix3.org>
Mon, 28 Sep 2015 14:06:58 +0000 (14:06 +0000)
The current values were both inaccurate (especially for dynamically
linked executables) and using the wrong unit (bytes, instead of
kilobytes times ticks-of-execution).  For now we are better off not
populating these fields at all.

Change-Id: I195a8fa8db909e64a833eec25f59c9ee0b89bdc5

minix/servers/vfs/exec.c
minix/servers/vfs/fproc.h
minix/servers/vfs/misc.c
minix/tests/test75.c
minix/usr.bin/trace/service/vfs.c

index b1049fa3eb35e694201b29648d6c7051e7beed94..d9dddafe5624c8e315aa3097af0ae3a016b7e84e 100644 (file)
@@ -217,9 +217,6 @@ int pm_exec(vir_bytes path, size_t path_len, vir_bytes frame, size_t frame_len,
   execi.args.stack_high = minix_get_user_sp();
   execi.args.stack_size = DEFAULT_STACK_LIMIT;
 
-  fp->text_size = 0;
-  fp->data_size = 0;
-
   lookup_init(&resolve, fullpath, PATH_NOFLAGS, &execi.vmp, &execi.vp);
 
   resolve.l_vmnt_lock = VMNT_READ;
@@ -381,8 +378,6 @@ int pm_exec(vir_bytes path, size_t path_len, vir_bytes frame, size_t frame_len,
 
   /* Remember the new name of the process */
   strlcpy(fp->fp_name, execi.args.progname, PROC_NAME_LEN);
-  fp->text_size = execi.args.text_size;
-  fp->data_size = execi.args.data_size;
 
 pm_execfinal:
   if(newfilp) unlock_filp(newfilp);
index d543be6f83e087ba1b20cb1c062cc6f0202f9e7a..25f6eddff166e4ce826056f8f2c9d8227632ef87 100644 (file)
@@ -55,9 +55,6 @@ EXTERN struct fproc {
   int fp_vp_rdlocks;           /* number of read-only locks on vnodes */
   int fp_vmnt_rdlocks;         /* number of read-only locks on vmnts */
 #endif
-
-  vir_bytes text_size;         /* text segment size of current process */
-  vir_bytes data_size;         /* data segment size of current process */
 } fproc[NR_PROCS];
 
 /* fp_flags */
index 6e740f8a232076800eee4db8176683b87c713f12..64d3846815c8edea65a7d1a1c1a065270181ff3d 100644 (file)
@@ -975,9 +975,6 @@ int do_getrusage(void)
 
        r_usage.ru_inblock = 0;
        r_usage.ru_oublock = 0;
-       r_usage.ru_ixrss = fp->text_size;
-       r_usage.ru_idrss = fp->data_size;
-       r_usage.ru_isrss = DEFAULT_STACK_LIMIT;
 
        return sys_datacopy_wrapper(SELF, (vir_bytes) &r_usage, who_e,
                m_in.m_lc_vfs_rusage.addr, (phys_bytes) sizeof(r_usage));
index dd8b88629981f045c6ad0b6503290d9dd1a9aa96..ac2298b4bd834f78615f60aa9178a713a7ddc05d 100644 (file)
@@ -68,20 +68,11 @@ main(int argc, char *argv[])
        }
        CHECK_NOT_ZERO_FIELD(r_usage1, ru_utime.tv_sec);
        CHECK_NOT_ZERO_FIELD(r_usage1, ru_maxrss);
-       CHECK_NOT_ZERO_FIELD(r_usage1, ru_ixrss);
-       CHECK_NOT_ZERO_FIELD(r_usage1, ru_idrss);
-       CHECK_NOT_ZERO_FIELD(r_usage1, ru_isrss);
        if (getrusage(RUSAGE_CHILDREN, &r_usage2) != 0) {
                e(1);
                exit(1);
        }
        CHECK_NOT_ZERO_FIELD(r_usage2, ru_maxrss);
-       CHECK_NOT_ZERO_FIELD(r_usage2, ru_ixrss);
-       CHECK_NOT_ZERO_FIELD(r_usage2, ru_idrss);
-       CHECK_NOT_ZERO_FIELD(r_usage2, ru_isrss);
-       CHECK_EQUAL_FIELD(r_usage1, r_usage2, ru_ixrss);
-       CHECK_EQUAL_FIELD(r_usage1, r_usage2, ru_idrss);
-       CHECK_EQUAL_FIELD(r_usage1, r_usage2, ru_isrss);
        if ((child = fork()) == 0) {
                /*
                 * We cannot do this part of the test in the parent, since
@@ -110,12 +101,6 @@ main(int argc, char *argv[])
                }
                CHECK_NOT_ZERO_FIELD(r_usage3, ru_utime.tv_sec);
                CHECK_NOT_ZERO_FIELD(r_usage3, ru_maxrss);
-               CHECK_NOT_ZERO_FIELD(r_usage3, ru_ixrss);
-               CHECK_NOT_ZERO_FIELD(r_usage3, ru_idrss);
-               CHECK_NOT_ZERO_FIELD(r_usage3, ru_isrss);
-               CHECK_EQUAL_FIELD(r_usage1, r_usage3, ru_ixrss);
-               CHECK_EQUAL_FIELD(r_usage1, r_usage3, ru_idrss);
-               CHECK_EQUAL_FIELD(r_usage1, r_usage3, ru_isrss);
        }
        quit();
 
index 12e9965ab35a69de90e70058f154d84a153c13b0..d3664a5fcb4d2b57bfacfe009b793fc9b44b9e4a 100644 (file)
@@ -1349,11 +1349,6 @@ vfs_getrusage_in(struct trace_proc * proc, const message * m_out,
                        put_value(proc, "ru_inblock", "%ld", buf.ru_inblock);
                        put_value(proc, "ru_oublock", "%ld", buf.ru_oublock);
                }
-               if (verbose > 0) {
-                       put_value(proc, "ru_ixrss", "%ld", buf.ru_ixrss);
-                       put_value(proc, "ru_idrss", "%ld", buf.ru_idrss);
-                       put_value(proc, "ru_isrss", "%ld", buf.ru_isrss);
-               }
 
                put_close_struct(proc, verbose > 1);
        }