mswap.patch - 2.4.20
Hi ,
I dis this small patch , because i need to know information about swap´s consume.
patch for kernel 2.4.20
thanks
memory.c renamed from memoryo.c +26 -0
@@ -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 ; +}
Quoted 4 lines · Breno
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.
Quoted 25 lines
memory.c renamed from memoryo.c +25
-0+ +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 ; +}
Signature · 5 lines
Russell King ([email protected]) 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