diff options
Diffstat (limited to 'debian/patches/700007-Use-the-slab-allocator.patch')
-rw-r--r-- | debian/patches/700007-Use-the-slab-allocator.patch | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/debian/patches/700007-Use-the-slab-allocator.patch b/debian/patches/700007-Use-the-slab-allocator.patch new file mode 100644 index 0000000..57eb7a0 --- /dev/null +++ b/debian/patches/700007-Use-the-slab-allocator.patch @@ -0,0 +1,63 @@ +From ad33ca5d3fbc25618d26b7af4d9a67be041c779a Mon Sep 17 00:00:00 2001 +From: Justus Winter <justus@gnupg.org> +Date: Fri, 26 Feb 2016 13:43:11 +0100 +Subject: [PATCH gnumach 7/8] Use the slab allocator + +--- + device/intr.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/device/intr.c b/device/intr.c +index b0dcd83..0fa43c5 100644 +--- a/device/intr.c ++++ b/device/intr.c +@@ -10,6 +10,9 @@ + #define sti() __asm__ __volatile__ ("sti": : :"memory") + #define cli() __asm__ __volatile__ ("cli": : :"memory") + ++/* The cache which holds our proxy memory objects. */ ++static struct kmem_cache intr_entry_cache; ++ + struct intr_entry + { + queue_chain_t chain; +@@ -58,7 +61,7 @@ insert_intr_entry (int line, ipc_port_t dest, struct intr_entry **entry) + struct intr_entry *e, *new; + int free = 0; + +- new = (struct intr_entry *) kalloc (sizeof (*new)); ++ new = (struct intr_entry *) kmem_cache_alloc (&intr_entry_cache); + if (new == NULL) + return D_NO_MEMORY; + new->line = line; +@@ -81,7 +84,7 @@ insert_intr_entry (int line, ipc_port_t dest, struct intr_entry **entry) + out: + sti (); + if (free) +- kfree ((vm_offset_t) new, sizeof (*new)); ++ kmem_cache_free (&intr_entry_cache, (vm_offset_t) new); + *entry = new; + return err; + } +@@ -146,6 +149,9 @@ intr_thread () + queue_init (&intr_queue); + init_mach_intr_notification (&mach_intr_notification_template); + ++ kmem_cache_init (&intr_entry_cache, "intr_entry", ++ sizeof (struct intr_entry), 0, NULL, 0); ++ + for (;;) + { + assert_wait ((event_t) &intr_thread, FALSE); +@@ -183,7 +189,7 @@ intr_thread () + assert (!queue_empty (&intr_queue)); + queue_remove (&intr_queue, e, struct intr_entry *, chain); + sti (); +- kfree ((vm_offset_t) e, sizeof (*e)); ++ kmem_cache_free (&intr_entry_cache, (vm_offset_t) e); + cli (); + } + } +-- +2.1.4 + |