tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Unit confusion in kinfo_proc2



It seems there is confusion wether a vmpsace vm_map.size element is
measured in bytes or pages. The uvm code seems to treat it as bytes,
so I guess we should apply something like this patch?

Note the correct usage a few lines below the patched one...

Martin

Index: kern_proc.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_proc.c,v
retrieving revision 1.183
diff -u -1 -0 -r1.183 kern_proc.c
--- kern_proc.c 13 Apr 2012 15:32:15 -0000      1.183
+++ kern_proc.c 3 Jun 2012 12:54:41 -0000
@@ -2272,21 +2272,21 @@
 
        ki->p_nlwps = p->p_nlwps;
        ki->p_realflag = ki->p_flag;
 
        if (p->p_stat != SIDL && !P_ZOMBIE(p) && !zombie) {
                vm = p->p_vmspace;
                ki->p_vm_rssize = vm_resident_count(vm);
                ki->p_vm_tsize = vm->vm_tsize;
                ki->p_vm_dsize = vm->vm_dsize;
                ki->p_vm_ssize = vm->vm_ssize;
-               ki->p_vm_vsize = vm->vm_map.size;
+               ki->p_vm_vsize = atop(vm->vm_map.size);
                /*
                 * Since the stack is initially mapped mostly with
                 * PROT_NONE and grown as needed, adjust the "mapped size"
                 * to skip the unused stack portion.
                 */
                ki->p_vm_msize =
                    atop(vm->vm_map.size) - vm->vm_issize + vm->vm_ssize;
 
                /* Pick the primary (first) LWP */
                l = proc_active_lwp(p);


Home | Main Index | Thread Index | Old Index