]> git.itanic.dy.fi Git - scan-pagemap/commitdiff
Compact struct pageframe
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Thu, 19 Aug 2010 14:51:20 +0000 (17:51 +0300)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Thu, 19 Aug 2010 14:51:20 +0000 (17:51 +0300)
It really makes no sense to have map_list structure embedded in the
pageframe list. All we need is a list_head that contains map_list
entries.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
analyze.c
main.c
pagemap.h
parse.c

index c9ed95dcd607b7d685f56ad51630b567adc5c5c7..6d65f02a751fa8b4a31b83e55a4ff8f8925bb167 100644 (file)
--- a/analyze.c
+++ b/analyze.c
@@ -42,10 +42,10 @@ static void count_pages(struct bintree *b, struct bintree_ops *ops)
        struct maps_list *ml;
 
        if (af->pid) {
-               if (list_empty(&pf->ml.list)) {
+               if (list_empty(&pf->ml)) {
                        return;
                }
-               list_for_each_entry(ml, &pf->ml.list, list) {
+               list_for_each_entry(ml, &pf->ml, list) {
                        if (ml->map->pid == af->pid)
                                goto get_stats;
                }
diff --git a/main.c b/main.c
index 46e6861324c9337dfa23268971e0bd1850d08685..092f2247ba80a93eb24b68016361e9f0ad71712d 100644 (file)
--- a/main.c
+++ b/main.c
@@ -93,7 +93,7 @@ int main(int argc, char *argv[])
        }
 
        memset(&pf, 0, sizeof(pf));
-       INIT_LIST_HEAD(&pf.ml.list);
+       INIT_LIST_HEAD(&pf.ml);
 
        memset(&process_list, 0, sizeof(process_list));
        INIT_LIST_HEAD(&process_list.list);
index c9a6d81b846618a9248f68d940a073756f8e709e..1d4780e5c9395fa1a1a063351c36a689b2aad651 100644 (file)
--- a/pagemap.h
+++ b/pagemap.h
@@ -21,7 +21,7 @@ struct maps_list {
 
 struct pageframe {
        struct bintree tree;
-       struct maps_list ml;    /* List to mappings which point to this pfn */
+       struct list_head ml;    /* List of mappings which refer to this pfn */
 
        unsigned long long pf;  /* page frame entry from /proc/pid/pagemap */
 
diff --git a/parse.c b/parse.c
index b0afe7ace7923af5da6aea34c801d17db1818e56..76b0eec7c81ccf54f81542eab9ed78acf47afc23 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -91,7 +91,7 @@ static struct pageframe *alloc_pageframe(void)
                goto err;
 
        clear_pageframe(pageframe);
-       INIT_LIST_HEAD(&pageframe->ml.list);
+       INIT_LIST_HEAD(&pageframe->ml);
 err:
        return pageframe;
 }
@@ -278,7 +278,7 @@ static int parse_pageframe(FILE *file, struct pageframe *pf_tree,
                         */
                        tmp = alloc_maplist();
                        tmp->map = map;
-                       list_add(&tmp->list, &match->ml.list);
+                       list_add(&tmp->list, &match->ml);
 
                        if (page_present(match))
                                map->pages_present++;