lkml.org 
[lkml]   [2003]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: mswap.patch - 2.4.20
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:48    [W:0.496 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site