mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* getrusage() patch
@ 2001-07-19 14:29 Alex Holden
  0 siblings, 0 replies; only message in thread
From: Alex Holden @ 2001-07-19 14:29 UTC (permalink / raw)
  To: linux-kernel

This patch fixes Squid's cacheMaxResSize statistic by causing
getrusage() to fill in the ru_maxrss member rather than leave it as 0.
Is it correct?

--- linux-2.4.6-clean/kernel/sys.c      Thu Jul 19 12:18:15 2001
+++ linux-2.4.6-getrusage-fixed/kernel/sys.c    Thu Jul 19 11:59:24 2001

@@ -1154,6 +1154,7 @@
 int getrusage(struct task_struct *p, int who, struct rusage *ru)
 {
        struct rusage r;
+       struct mm_struct *mm;

        memset((char *) &r, 0, sizeof(r));
        switch (who) {
@@ -1165,6 +1166,13 @@
                        r.ru_minflt = p->min_flt;
                        r.ru_majflt = p->maj_flt;
                        r.ru_nswap = p->nswap;
+                       task_lock(p);
+                       if((mm = p->mm)) atomic_inc(&mm->mm_users);
+                       task_unlock(p);
+                       if(mm) {
+                               r.ru_maxrss = mm->rss;
+                               mmput(mm);
+                       }
                        break;
                case RUSAGE_CHILDREN:
                        r.ru_utime.tv_sec =
CT_TO_SECS(p->times.tms_cutime);


--------------------------------------------------------------------
This email has been Scanned for Viruses by Zereau Internet
For Info Tel: +44 (0)1642 867700  |  www.zereau.net

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-07-19 14:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-19 14:29 getrusage() patch Alex Holden

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®