Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108594317
D46942.id144249.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D46942.id144249.diff
View Options
diff --git a/lib/libkvm/kvm_proc.c b/lib/libkvm/kvm_proc.c
--- a/lib/libkvm/kvm_proc.c
+++ b/lib/libkvm/kvm_proc.c
@@ -320,6 +320,7 @@
(void)kvm_read(kd, (u_long)proc.p_vmspace,
(char *)&vmspace, sizeof(vmspace));
kp->ki_size = vmspace.vm_map.size;
+ kp->ki_maxsize = vmspace.vm_map.max_size;
/*
* Approximate the kernel's method of calculating
* this field.
diff --git a/sys/compat/freebsd32/freebsd32.h b/sys/compat/freebsd32/freebsd32.h
--- a/sys/compat/freebsd32/freebsd32.h
+++ b/sys/compat/freebsd32/freebsd32.h
@@ -367,6 +367,7 @@
short ki_spare_short2;
gid_t ki_groups[KI_NGROUPS];
uint32_t ki_size;
+ uint32_t ki_maxsize;
int32_t ki_rssize;
int32_t ki_swrss;
int32_t ki_tsize;
diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c
--- a/sys/compat/linprocfs/linprocfs.c
+++ b/sys/compat/linprocfs/linprocfs.c
@@ -1154,6 +1154,7 @@
* implement it. Submissions are welcome.
*/
sbuf_printf(sb, "VmSize:\t%8ju kB\n", B2K((uintmax_t)kp.ki_size));
+ sbuf_printf(sb, "VmPeak:\t%8ju kB\n", B2K((uintmax_t)kp.ki_maxsize));
sbuf_printf(sb, "VmLck:\t%8u kB\n", P2K(0)); /* XXX */
sbuf_printf(sb, "VmRSS:\t%8ju kB\n", P2K((uintmax_t)kp.ki_rssize));
sbuf_printf(sb, "VmData:\t%8ju kB\n", P2K((uintmax_t)kp.ki_dsize));
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -1139,6 +1139,7 @@
struct vmspace *vm = p->p_vmspace;
kp->ki_size = vm->vm_map.size;
+ kp->ki_maxsize = vm->vm_map.max_size;
kp->ki_rssize = vmspace_resident_count(vm); /*XXX*/
FOREACH_THREAD_IN_PROC(p, td0)
kp->ki_rssize += td0->td_kstack_pages;
@@ -1445,6 +1446,7 @@
for (i = 0; i < KI_NGROUPS; i++)
CP(*ki, *ki32, ki_groups[i]);
CP(*ki, *ki32, ki_size);
+ CP(*ki, *ki32, ki_maxsize);
CP(*ki, *ki32, ki_rssize);
CP(*ki, *ki32, ki_swrss);
CP(*ki, *ki32, ki_tsize);
diff --git a/sys/sys/user.h b/sys/sys/user.h
--- a/sys/sys/user.h
+++ b/sys/sys/user.h
@@ -84,7 +84,7 @@
* function kvm_proclist in lib/libkvm/kvm_proc.c .
*/
#define KI_NSPARE_INT 2
-#define KI_NSPARE_LONG 12
+#define KI_NSPARE_LONG 11
#define KI_NSPARE_PTR 5
#ifndef _KERNEL
@@ -213,6 +213,7 @@
struct pwddesc *ki_pd; /* pointer to process paths info */
void *ki_spareptrs[KI_NSPARE_PTR]; /* spare room for growth */
long ki_sparelongs[KI_NSPARE_LONG]; /* spare room for growth */
+ vm_size_t ki_maxsize; /* maximum virtual size so far */
long ki_sflag; /* PS_* flags */
long ki_tdflags; /* XXXKSE kthread flag */
};
diff --git a/sys/vm/vm_map.h b/sys/vm/vm_map.h
--- a/sys/vm/vm_map.h
+++ b/sys/vm/vm_map.h
@@ -207,6 +207,7 @@
struct mtx system_mtx;
int nentries; /* Number of entries */
vm_size_t size; /* virtual size */
+ vm_size_t max_size; /* Max of virtual size so far */
u_int timestamp; /* Version number */
u_char needs_wakeup;
u_char system_map; /* (c) Am I a system map? */
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -889,6 +889,7 @@
{
map->header.eflags = MAP_ENTRY_HEADER;
+ map->max_size = 0;
map->needs_wakeup = FALSE;
map->system_map = 0;
map->pmap = pmap;
@@ -1812,8 +1813,11 @@
* Insert the new entry into the list
*/
vm_map_entry_link(map, new_entry);
- if ((new_entry->eflags & MAP_ENTRY_GUARD) == 0)
+ if ((new_entry->eflags & MAP_ENTRY_GUARD) == 0) {
map->size += new_entry->end - new_entry->start;
+ if (map->size > map->max_size)
+ map->max_size = map->size;
+ }
/*
* Try to coalesce the new entry with both the previous and next
@@ -4327,6 +4331,8 @@
return;
entrysize = entry->end - entry->start;
vm2->vm_map.size += entrysize;
+ if (vm2->vm_map.size > vm2->vm_map.max_size)
+ vm2->vm_map.max_size = vm2->vm_map.size;
if (entry->eflags & (MAP_ENTRY_GROWS_DOWN | MAP_ENTRY_GROWS_UP)) {
vm2->vm_ssize += btoc(entrysize);
} else if (entry->start >= (vm_offset_t)vm1->vm_daddr &&
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 27, 6:17 PM (6 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16203659
Default Alt Text
D46942.id144249.diff (3 KB)
Attached To
Mode
D46942: vm_map: Record the maximum size of the map over time
Attached
Detach File
Event Timeline
Log In to Comment