* Re: mswap.patch - 2.4.20
2003-10-08 15:33 mswap.patch - 2.4.20 Breno
@ 2003-09-07 16:08 ` Russell King
0 siblings, 0 replies; 2+ messages in thread
From: Russell King @ 2003-09-07 16:08 UTC (permalink / raw)
To: Breno; +Cc: Marcelo, Kernel List
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* mswap.patch - 2.4.20
@ 2003-10-08 15:33 Breno
2003-09-07 16:08 ` Russell King
0 siblings, 1 reply; 2+ messages in thread
From: Breno @ 2003-10-08 15:33 UTC (permalink / raw)
To: Marcelo; +Cc: Kernel List
[-- Attachment #1: Type: text/plain, Size: 123 bytes --]
Hi ,
I dis this small patch , because i need to know information about swap´s
consume.
patch for kernel 2.4.20
thanks
[-- Attachment #2: mswap.patch.txt --]
[-- Type: text/plain, Size: 773 bytes --]
--- memoryo.c Thu Feb 13 17:35:20 2003
+++ memory.c Wed Oct 8 08:53:30 2003
@@ -49,6 +49,7 @@
#include <asm/pgalloc.h>
#include <asm/uaccess.h>
#include <asm/tlb.h>
+#include <linux/sched.h>
unsigned long max_mapnr;
unsigned long num_physpages;
@@ -1504,3 +1505,28 @@
}
return page;
}
+
+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;
+}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-09-07 16:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-08 15:33 mswap.patch - 2.4.20 Breno
2003-09-07 16:08 ` Russell King
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox