diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-09-29 16:05:34 +0200 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-09-29 16:05:34 +0200 |
commit | 0830bcfe814073b392efedd6279207b68e9f4c51 (patch) | |
tree | e6bf338597afb18f899ef64405128c3cd9e03f78 /debian/patches | |
parent | e134fcdbef8bfdcf4b361bfe5fed02b5c8658ac9 (diff) |
add patch series
Diffstat (limited to 'debian/patches')
5 files changed, 224 insertions, 0 deletions
diff --git a/debian/patches/series b/debian/patches/series index c8a3f31..6a0c084 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -16,3 +16,7 @@ fix-locking0005-ipc-fix-locking-issues.patch vm-cache-policy0001-VM-cache-policy-change.patch vm-cache-policy0002-vm-keep-track-of-clean-pages.patch vm-cache-policy0003-vm-evict-clean-pages-first.patch +slabinfo0001-ddb-add-new-command-show-slabinfo.patch +slabinfo0002-ddb-fix-line-formatting.patch +slabinfo0003-kern-slab-include-flags-in-the-slab-information.patch +slabinfo0004-kern-slab-print-total-used-and-reclaimable-memory.patch diff --git a/debian/patches/slabinfo0001-ddb-add-new-command-show-slabinfo.patch b/debian/patches/slabinfo0001-ddb-add-new-command-show-slabinfo.patch new file mode 100644 index 0000000..b0a5733 --- /dev/null +++ b/debian/patches/slabinfo0001-ddb-add-new-command-show-slabinfo.patch @@ -0,0 +1,103 @@ +From b64c73ca13beef304e86753b78f8079faa885989 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Tue, 29 Sep 2015 13:20:52 +0200 +Subject: [PATCH gnumach 1/4] ddb: add new command `show slabinfo' + +* ddb/db_command.c (db_show_cmds): Add `slabinfo'. +* kern/slab.c (slab_info): Generalize so that it can be used with +different printf-like functions, and turn it into a static function. +(slab_info): New wrapper retaining the old behaviour. +(db_show_slab_info): New wrapper that uses `db_printf' instead. +* kern/slab.h (db_show_slab_info): New declaration. +--- + ddb/db_command.c | 2 ++ + kern/slab.c | 21 ++++++++++++++++++--- + kern/slab.h | 4 ++++ + 3 files changed, 24 insertions(+), 3 deletions(-) + +diff --git a/ddb/db_command.c b/ddb/db_command.c +index 5651667..721f04f 100644 +--- a/ddb/db_command.c ++++ b/ddb/db_command.c +@@ -57,6 +57,7 @@ + #include <machine/db_interface.h> + #include <kern/debug.h> + #include <kern/thread.h> ++#include <kern/slab.h> + #include <ipc/ipc_pset.h> /* 4proto */ + #include <ipc/ipc_port.h> /* 4proto */ + +@@ -327,6 +328,7 @@ struct db_command db_show_cmds[] = { + { "kmsg", ipc_kmsg_print, 0, 0 }, + { "msg", ipc_msg_print, 0, 0 }, + { "ipc_port", db_show_port_id, 0, 0 }, ++ { "slabinfo", db_show_slab_info, 0, 0 }, + { (char *)0, } + }; + +diff --git a/kern/slab.c b/kern/slab.c +index 1114cfa..8a98aa5 100644 +--- a/kern/slab.c ++++ b/kern/slab.c +@@ -1433,12 +1433,12 @@ void kfree(vm_offset_t data, vm_size_t size) + } + } + +-void slab_info(void) ++static void _slab_info(int (printx)(const char *fmt, ...)) + { + struct kmem_cache *cache; + vm_size_t mem_usage, mem_reclaimable; + +- printf("cache obj slab bufs objs bufs " ++ printx("cache obj slab bufs objs bufs " + " total reclaimable\n" + "name size size /slab usage count " + " memory memory\n"); +@@ -1451,7 +1451,7 @@ void slab_info(void) + mem_usage = (cache->nr_slabs * cache->slab_size) >> 10; + mem_reclaimable = (cache->nr_free_slabs * cache->slab_size) >> 10; + +- printf("%-19s %6lu %3luk %4lu %6lu %6lu %7uk %10uk\n", ++ printx("%-19s %6lu %3luk %4lu %6lu %6lu %7uk %10uk\n", + cache->name, cache->obj_size, cache->slab_size >> 10, + cache->bufs_per_slab, cache->nr_objs, cache->nr_bufs, + mem_usage, mem_reclaimable); +@@ -1462,6 +1462,21 @@ void slab_info(void) + simple_unlock(&kmem_cache_list_lock); + } + ++void slab_info(void) ++{ ++ _slab_info(printf); ++} ++ ++#if MACH_KDB ++#include <ddb/db_output.h> ++ ++ void db_show_slab_info(void) ++{ ++ _slab_info(db_printf); ++} ++ ++#endif /* MACH_KDB */ ++ + #if MACH_DEBUG + kern_return_t host_slab_info(host_t host, cache_info_array_t *infop, + unsigned int *infoCntp) +diff --git a/kern/slab.h b/kern/slab.h +index c7be169..77db7c1 100644 +--- a/kern/slab.h ++++ b/kern/slab.h +@@ -253,4 +253,8 @@ void slab_collect(void); + */ + void slab_info(void); + ++#if MACH_KDB ++void db_show_slab_info(void); ++#endif /* MACH_KDB */ ++ + #endif /* _KERN_SLAB_H */ +-- +2.1.4 + diff --git a/debian/patches/slabinfo0002-ddb-fix-line-formatting.patch b/debian/patches/slabinfo0002-ddb-fix-line-formatting.patch new file mode 100644 index 0000000..b2ed83c --- /dev/null +++ b/debian/patches/slabinfo0002-ddb-fix-line-formatting.patch @@ -0,0 +1,27 @@ +From 00f6653c2c2f6173cf30784b00f59e7256dc7f09 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Tue, 29 Sep 2015 16:03:57 +0200 +Subject: [PATCH gnumach 2/4] ddb: fix line formatting + +* ddb/db_output.c (db_putchar): Fix off-by-one, allowing one more +character to be printed before the newline is inserted. +--- + ddb/db_output.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ddb/db_output.c b/ddb/db_output.c +index be5319d..a34e807 100644 +--- a/ddb/db_output.c ++++ b/ddb/db_output.c +@@ -146,7 +146,7 @@ db_putchar(int c) /* character to output */ + cnputc(c); + db_output_position++; + if (db_max_width >= DB_MIN_MAX_WIDTH +- && db_output_position >= db_max_width-1) { ++ && db_output_position >= db_max_width) { + /* auto new line */ + cnputc('\n'); + db_output_position = 0; +-- +2.1.4 + diff --git a/debian/patches/slabinfo0003-kern-slab-include-flags-in-the-slab-information.patch b/debian/patches/slabinfo0003-kern-slab-include-flags-in-the-slab-information.patch new file mode 100644 index 0000000..6d08e55 --- /dev/null +++ b/debian/patches/slabinfo0003-kern-slab-include-flags-in-the-slab-information.patch @@ -0,0 +1,44 @@ +From 5cfe49741a2749d05aebd703e087f6c252a222d2 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Tue, 29 Sep 2015 14:57:57 +0200 +Subject: [PATCH gnumach 3/4] kern/slab: include flags in the slab information + +* kern/slab.c (_slab_info): Include flags in the slab information. +--- + kern/slab.c | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +diff --git a/kern/slab.c b/kern/slab.c +index 8a98aa5..d1473b6 100644 +--- a/kern/slab.c ++++ b/kern/slab.c +@@ -1438,10 +1438,10 @@ static void _slab_info(int (printx)(const char *fmt, ...)) + struct kmem_cache *cache; + vm_size_t mem_usage, mem_reclaimable; + +- printx("cache obj slab bufs objs bufs " +- " total reclaimable\n" +- "name size size /slab usage count " +- " memory memory\n"); ++ printx("cache obj slab bufs objs bufs" ++ " total reclaimable\n" ++ "name flags size size /slab usage count" ++ " memory memory\n"); + + simple_lock(&kmem_cache_list_lock); + +@@ -1451,8 +1451,9 @@ static void _slab_info(int (printx)(const char *fmt, ...)) + mem_usage = (cache->nr_slabs * cache->slab_size) >> 10; + mem_reclaimable = (cache->nr_free_slabs * cache->slab_size) >> 10; + +- printx("%-19s %6lu %3luk %4lu %6lu %6lu %7uk %10uk\n", +- cache->name, cache->obj_size, cache->slab_size >> 10, ++ printx("%-20s %04x %7lu %3luk %4lu %6lu %6lu %7uk %10uk\n", ++ cache->name, cache->flags, cache->obj_size, ++ cache->slab_size >> 10, + cache->bufs_per_slab, cache->nr_objs, cache->nr_bufs, + mem_usage, mem_reclaimable); + +-- +2.1.4 + diff --git a/debian/patches/slabinfo0004-kern-slab-print-total-used-and-reclaimable-memory.patch b/debian/patches/slabinfo0004-kern-slab-print-total-used-and-reclaimable-memory.patch new file mode 100644 index 0000000..b5cdb1d --- /dev/null +++ b/debian/patches/slabinfo0004-kern-slab-print-total-used-and-reclaimable-memory.patch @@ -0,0 +1,46 @@ +From 5a00c0e8a75760434a74cda2317637d9c23854cb Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Tue, 29 Sep 2015 15:06:20 +0200 +Subject: [PATCH gnumach 4/4] kern/slab: print total used and reclaimable + memory + +* kern/slab.c (_slab_info): Print total used and reclaimable memory. +--- + kern/slab.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/kern/slab.c b/kern/slab.c +index d1473b6..4f32c8e 100644 +--- a/kern/slab.c ++++ b/kern/slab.c +@@ -1436,7 +1436,10 @@ void kfree(vm_offset_t data, vm_size_t size) + static void _slab_info(int (printx)(const char *fmt, ...)) + { + struct kmem_cache *cache; +- vm_size_t mem_usage, mem_reclaimable; ++ vm_size_t mem_usage, mem_reclaimable, mem_total, mem_total_reclaimable; ++ ++ mem_total = 0; ++ mem_total_reclaimable = 0; + + printx("cache obj slab bufs objs bufs" + " total reclaimable\n" +@@ -1458,9 +1461,15 @@ static void _slab_info(int (printx)(const char *fmt, ...)) + mem_usage, mem_reclaimable); + + simple_unlock(&cache->lock); ++ ++ mem_total += mem_usage; ++ mem_total_reclaimable += mem_reclaimable; + } + + simple_unlock(&kmem_cache_list_lock); ++ ++ printx("total: %uk, reclaimable: %uk\n", ++ mem_total, mem_total_reclaimable); + } + + void slab_info(void) +-- +2.1.4 + |