From 3f566ed80b30b6730837eb84e7fbe8077b9a0107 Mon Sep 17 00:00:00 2001 From: Timo Kokkonen Date: Thu, 19 Aug 2010 17:51:20 +0300 Subject: [PATCH] Compact struct pageframe 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 --- analyze.c | 4 ++-- main.c | 2 +- pagemap.h | 2 +- parse.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/analyze.c b/analyze.c index c9ed95d..6d65f02 100644 --- 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 46e6861..092f224 100644 --- 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); diff --git a/pagemap.h b/pagemap.h index c9a6d81..1d4780e 100644 --- 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 b0afe7a..76b0eec 100644 --- 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++; -- 2.45.0