From: David van Moolenbroek Date: Sun, 27 Sep 2015 11:28:56 +0000 (+0000) Subject: getrusage(2): zero out ru_i[xds]rss fields X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=cd27b2627a4d19f83649c1b00b9c236cf7a66266;p=minix.git getrusage(2): zero out ru_i[xds]rss fields 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 --- diff --git a/minix/servers/vfs/exec.c b/minix/servers/vfs/exec.c index b1049fa3e..d9dddafe5 100644 --- a/minix/servers/vfs/exec.c +++ b/minix/servers/vfs/exec.c @@ -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); diff --git a/minix/servers/vfs/fproc.h b/minix/servers/vfs/fproc.h index d543be6f8..25f6eddff 100644 --- a/minix/servers/vfs/fproc.h +++ b/minix/servers/vfs/fproc.h @@ -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 */ diff --git a/minix/servers/vfs/misc.c b/minix/servers/vfs/misc.c index 6e740f8a2..64d384681 100644 --- a/minix/servers/vfs/misc.c +++ b/minix/servers/vfs/misc.c @@ -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)); diff --git a/minix/tests/test75.c b/minix/tests/test75.c index dd8b88629..ac2298b4b 100644 --- a/minix/tests/test75.c +++ b/minix/tests/test75.c @@ -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(); diff --git a/minix/usr.bin/trace/service/vfs.c b/minix/usr.bin/trace/service/vfs.c index 12e9965ab..d3664a5fc 100644 --- a/minix/usr.bin/trace/service/vfs.c +++ b/minix/usr.bin/trace/service/vfs.c @@ -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); }