From: Russell King <rmk@arm.linux.org.uk>
To: Breno <brenosp@brasilsec.com.br>
Cc: Marcelo <marcelo@conectiva.com.br>,
Kernel List <linux-kernel@vger.kernel.org>
Subject: Re: mswap.patch - 2.4.20
Date: Sun, 7 Sep 2003 17:08:09 +0100 [thread overview]
Message-ID: <20030907170809.C23176@flint.arm.linux.org.uk> (raw)
In-Reply-To: <000a01c38db1$76b4e400$f8e4a7c8@bsb.virtua.com.br>; from brenosp@brasilsec.com.br on Wed, Oct 08, 2003 at 12:33:01PM -0300
On Wed, Oct 08, 2003 at 12:33:01PM -0300, Breno wrote:
> I dis this small patch , because i need to know information about swap´s
> consume.
>
> patch for kernel 2.4.20
The "&&" operator can be useful sometimes. I think this may be one of
those times.
> +
> +int show_swap_usage(void)
> +{
> + struct task_struct *p = NULL;
> +
> + for_each_task(p)
> + {
> + if(p != NULL)
> + {
> + if(p->pid != 1)
> + {
> + if(p->mm != NULL)
> + {
> + if(p->nswap > 0)
> + {
> + printk(KERN_CRIT"Process name: %s pid %d\n",p->comm,p->pid);
> + printk(KERN_CRIT"Nswap: %lu Totalvm %lu Cswap %lu\n",p->nswap,p->mm->total_vm,p->cnswap);
> + return 0;
> + }
> + }
> + }
> + }
> + }
> + return 0;
> +}
--
Russell King (rmk@arm.linux.org.uk) http://www.arm.linux.org.uk/personal/
Linux kernel maintainer of:
2.6 ARM Linux - http://www.arm.linux.org.uk/
2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/
2.6 Serial core
prev parent reply other threads:[~2003-09-07 16:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-08 15:33 mswap.patch - 2.4.20 Breno
2003-09-07 16:08 ` Russell King [this message]
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=20030907170809.C23176@flint.arm.linux.org.uk \
--to=rmk@arm.linux.org.uk \
--cc=brenosp@brasilsec.com.br \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo@conectiva.com.br \
/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