From: Alex Holden <alexh@zereau.net>
To: linux-kernel@vger.kernel.org
Subject: getrusage() patch
Date: Thu, 19 Jul 2001 15:29:22 +0100 [thread overview]
Message-ID: <3B56EEC2.6C3B8E76@zereau.net> (raw)
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
reply other threads:[~2001-07-19 14:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3B56EEC2.6C3B8E76@zereau.net \
--to=alexh@zereau.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®