DragonFly kernel List (threaded) for 2010-09
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
Re: troubleshooting dragonfly after compiling kernel
Alex Hornung <ahornung <at> gmail.com> writes:
>
> > I just added few fields int the structure vm_object, added some code to
vm_page.c
> > Added couple of functions to the vm_map.h and vm_map.c
> > Just to display proportional rss with the rss.
> > Also, added a field in struct kern_info and make changes to m_dragonfly.c
> > I checked any error in the code with lint and gcc on all the files i made
> > changes to.
>
> This is not enough information. Please send a patch for review or
> something, because right now this is pure guesswork. Also it would be
> of advantage if you rebased your work onto something more recent than
> 2.4.1.
>
> Cheers,
> Alex
>
>
Following the output of git diff, please have a look :
diff --git a/sys/kern/kern_kinfo.c b/sys/kern/kern_kinfo.c
index c8d0578..ecad09e 100644
--- a/sys/kern/kern_kinfo.c
+++ b/sys/kern/kern_kinfo.c
@@ -147,6 +147,7 @@ fill_kinfo_proc(struct proc *p, struct kinfo_proc *kp)
if (p->p_vmspace) {
kp->kp_vm_map_size = p->p_vmspace->vm_map.size;
kp->kp_vm_rssize = vmspace_resident_count(p->p_vmspace);
+ kp->kp_vm_prssize = vmspace_president_count(p->p_vmspace);
kp->kp_vm_swrss = p->p_vmspace->vm_swrss;
kp->kp_vm_tsize = p->p_vmspace->vm_tsize;
kp->kp_vm_dsize = p->p_vmspace->vm_dsize;
diff --git a/sys/sys/kinfo.h b/sys/sys/kinfo.h
index dc0242b..00b17aa 100644
--- a/sys/sys/kinfo.h
+++ b/sys/sys/kinfo.h
@@ -188,6 +188,7 @@ struct kinfo_proc {
vm_size_t kp_vm_map_size; /* vmmap virtual size */
segsz_t kp_vm_rssize; /* resident set size */
+ segsz_t kp_vm_prssize; /* proportional rss */
segsz_t kp_vm_swrss; /* rss before last swap */
segsz_t kp_vm_tsize; /* text size */
segsz_t kp_vm_dsize; /* data size */
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index a326037..4eb9026 100644
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -3657,3 +3657,20 @@ DB_SHOW_COMMAND(procvm, procvm)
}
#endif /* DDB */
+
+long vmap_resident_count(vm_map_t v)
+{
+ vm_map_entry_t entry;
+ vm_map_object_t *mobj;
+ vm_object_t obj;
+ long pres = 0;
+ entry = &(v->header);
+ while(entry->next != NULL){
+ mobj = &entry->object;
+ if(mobj->vm_object != NULL) {
+ obj = mobj->vm_object;
+ pres = pres + (long) (obj->agg_pv_list_count / obj->resident_page_count);
+ }
+ }
+ return pres;
+}
diff --git a/sys/vm/vm_map.h b/sys/vm/vm_map.h
index dc9b8e9..b07edeb 100644
--- a/sys/vm/vm_map.h
+++ b/sys/vm/vm_map.h
@@ -395,6 +395,14 @@ vmspace_resident_count(struct vmspace *vmspace)
return pmap_resident_count(vmspace_pmap(vmspace));
}
+long vmap_resident_count(vm_map_t);
+
+static __inline long
+vmspace_president_count(struct vmspace *vmspace)
+{
+ return vmap_resident_count(&vmspace->vm_map);
+}
+
/*
* Number of kernel maps and entries to statically allocate, required
* during boot to bootstrap the VM system.
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index e71b452..0212edd 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -154,6 +154,7 @@ _vm_object_allocate(objtype_t type, vm_size_t size,
vm_object_t object)
vm_object_set_flag(object, OBJ_ONEMAPPING);
object->paging_in_progress = 0;
object->resident_page_count = 0;
+ object->agg_pv_list_count = 0;
object->shadow_count = 0;
object->pg_color = next_index;
if ( size > (PQ_L2_SIZE / 3 + PQ_PRIME1))
diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h
index 7bccfd6..7db55d4 100644
--- a/sys/vm/vm_object.h
+++ b/sys/vm/vm_object.h
@@ -143,6 +143,7 @@ struct vm_object {
u_short pg_color; /* color of first page in obj */
u_short paging_in_progress; /* Paging (in or out) so don't collapse or destroy */
int resident_page_count; /* number of resident pages */
+ int agg_pv_list_count; /* aggregate pv_list count for all pages */
struct vm_object *backing_object; /* object that I'm a shadow of */
vm_ooffset_t backing_object_offset;/* Offset in backing object */
TAILQ_ENTRY(vm_object) pager_object_list; /* list of all objects of this pager
type */
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index 717522b..c481618 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -374,6 +374,11 @@ vm_page_insert(vm_page_t m, vm_object_t object, vm_pindex_t
pindex)
* show that the object has one more resident page.
*/
object->resident_page_count++;
+
+ /*
+ * Add the pv_list count of the page
+ */
+ object->agg_pv_list_count = object->agg_pv_list_count + m->md.pv_list_count;
/*
* Since we are inserting a new and possibly dirty page,
@@ -417,6 +422,7 @@ vm_page_remove(vm_page_t m)
*/
vm_page_rb_tree_RB_REMOVE(&object->rb_memq, m);
object->resident_page_count--;
+ object->agg_pv_list_count = object->agg_pv_list_count - m->md.pv_list_count;
object->generation++;
m->object = NULL;
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]