From 953c5ad1c72d55e3c017e7975becfa175ccdf7f5 Mon Sep 17 00:00:00 2001 From: hunt Date: Wed, 7 Dec 2005 20:02:04 +0000 Subject: 2005-12-07 Martin Hunt PR1923 * map.h (struct map_root): Remove membuf. (struct pmap): Define. (PMAP): Declare. * map.c (_stp_map_init): Use kmalloc() to allocate individual nodes instead of using vmalloc() to allocate one big chunk. (_stp_map_new): Use kmalloc. (_stp_pmap_new): Use kmalloc. Return a PMAP. (__stp_map_del): New function. Free all the nodes in a map. (_stp_map_del): Call __stp_map_del() then free map struct. (_stp_pmap_del): Takes a PMAP. Calls __stp_map_del() for each cpu. (_stp_pmap_printn_cpu): Change arg to PMAP. (_stp_pmap_agg): Change arg to PMAP. (_stp_pmap_get_agg): Change arg to PMAP. * map-stat.c (_stp_pmap_new_hstat_linear): Use PMAP instead of MAP. Fix allocations. (_stp_pmap_new_hstat_log): Ditto. * pmap-gen.c Fix all functions to take or return PMAPS instead of MAPS. * alloc.c: Remove everything except kmalloc_node(). All runtime code now uses kmalloc() directly. --- runtime/map-stat.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'runtime/map-stat.c') diff --git a/runtime/map-stat.c b/runtime/map-stat.c index c9ba4b02..6634a2b7 100644 --- a/runtime/map-stat.c +++ b/runtime/map-stat.c @@ -64,9 +64,9 @@ static MAP _stp_map_new_hstat_linear (unsigned max_entries, int ksize, int start return m; } -static MAP _stp_pmap_new_hstat_linear (unsigned max_entries, int ksize, int start, int stop, int interval) +static PMAP _stp_pmap_new_hstat_linear (unsigned max_entries, int ksize, int start, int stop, int interval) { - MAP map; + PMAP pmap; int size; int buckets = (stop - start) / interval; if ((stop - start) % interval) buckets++; @@ -74,12 +74,12 @@ static MAP _stp_pmap_new_hstat_linear (unsigned max_entries, int ksize, int star /* add size for buckets */ size = buckets * sizeof(int64_t) + sizeof(stat); - map = _stp_pmap_new (max_entries, STAT, ksize, size); - if (map) { + pmap = _stp_pmap_new (max_entries, STAT, ksize, size); + if (pmap) { int i; MAP m; for_each_cpu(i) { - m = _stp_per_cpu_ptr (map, i); + m = (MAP)per_cpu_ptr (pmap->map, i); m->hist.type = HIST_LINEAR; m->hist.start = start; m->hist.stop = stop; @@ -87,33 +87,33 @@ static MAP _stp_pmap_new_hstat_linear (unsigned max_entries, int ksize, int star m->hist.buckets = buckets; } /* now set agg map params */ - m = _stp_percpu_dptr(map); + m = &pmap->agg; m->hist.type = HIST_LINEAR; m->hist.start = start; m->hist.stop = stop; m->hist.interval = interval; m->hist.buckets = buckets; } - return map; + return pmap; } -static MAP _stp_pmap_new_hstat_log (unsigned max_entries, int key_size, int buckets) +static PMAP _stp_pmap_new_hstat_log (unsigned max_entries, int key_size, int buckets) { /* add size for buckets */ int size = buckets * sizeof(int64_t) + sizeof(stat); - MAP map = _stp_pmap_new (max_entries, STAT, key_size, size); - if (map) { + PMAP pmap = _stp_pmap_new (max_entries, STAT, key_size, size); + if (pmap) { int i; MAP m; for_each_cpu(i) { - m = _stp_per_cpu_ptr (map, i); + m = (MAP)per_cpu_ptr (pmap->map, i); m->hist.type = HIST_LOG; m->hist.buckets = buckets; } /* now set agg map params */ - m = _stp_percpu_dptr(map); + m = &pmap->agg; m->hist.type = HIST_LOG; m->hist.buckets = buckets; } - return map; + return pmap; } -- cgit