summaryrefslogtreecommitdiff
path: root/mach-defpager/mig-decls.h
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2014-03-15 14:06:15 +0100
committerJustus Winter <4winter@informatik.uni-hamburg.de>2014-03-25 08:55:55 +0100
commit07e46eb2e25583f0f3e06342f0c854769b353b10 (patch)
tree45f4d44f2b23064f64da6df2a4d47b79a027ed64 /mach-defpager/mig-decls.h
parent6d5511668545d00da4e3e5dd142b4f082c76b083 (diff)
mach-defpager: replace the magic typecast with a hash table
Previously, the mach-defpager used a "magic typecast" for object lookups. It renamed the port to the address of the associated object, and upon receiving a message it would cast the port name back to a pointer. While this might seem like an optimization, it actually makes the port handling in the kernel less efficient. Ports with small continuous names are stored in an array, while other ports get spilled in a splay tree. Replace the linked list of default_port_t objects with a hash table. Do not rename the ports, rather use the hash table to lookup objects associated with ports. * mach-defpager/default_pager.c (struct pager_port): Replace queue with hash table, remove count, move type declaration to priv.h. (pager_port_list_init): Adjust accordingly. (pager_port_list_insert): Likewise. (pager_port_list_delete): Likewise. (destroy_paging_partition): Replace queue_iterate with HURD_IHASH_ITERATE. (S_default_pager_objects): Likewise. (S_default_pager_object_pages): Likewise. (seqnos_memory_object_create): Do not rename the port but store it in the hash table. (S_default_pager_object_create): Likewise. * mach-defpager/priv.h (struct dstruct): Add fast-removal pointer. (pnameof): Remove obsolete macro definition. (dnameof): Likewise. * mach-defpager/mig-decls.h (begin_using_default_pager): Replace the magic typecast with a hash table lookup. * mach-defpager/Makefile (HURDLIBS): Add ihash.
Diffstat (limited to 'mach-defpager/mig-decls.h')
-rw-r--r--mach-defpager/mig-decls.h7
1 files changed, 2 insertions, 5 deletions
diff --git a/mach-defpager/mig-decls.h b/mach-defpager/mig-decls.h
index f63fef20..8118d61a 100644
--- a/mach-defpager/mig-decls.h
+++ b/mach-defpager/mig-decls.h
@@ -27,11 +27,8 @@
static inline struct dstruct * __attribute__ ((unused))
begin_using_default_pager (mach_port_t port)
{
- if (! MACH_PORT_VALID(port)
- || ((default_pager_t) dnameof(port))->pager != (port))
- return DEFAULT_PAGER_NULL;
-
- return (default_pager_t) dnameof(port);
+ return (default_pager_t) hurd_ihash_find (&all_pagers.htable,
+ (hurd_ihash_key_t) port);
}
#endif /* __MACH_DEFPAGER_MIG_DECLS_H__ */