diff options
author | Richard Braun <rbraun@sceen.net> | 2016-02-22 21:59:07 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2016-02-22 21:59:07 +0100 |
commit | b325f426b367d813b23799aeb058d7d3ac81f13d (patch) | |
tree | a17f7d46316faadd79958de3760c4ee744014e88 /vm/vm_page.h | |
parent | 9e7f22971be0f427601926b42b640426ab7da4db (diff) | |
download | gnumach-b325f426b367d813b23799aeb058d7d3ac81f13d.tar.gz gnumach-b325f426b367d813b23799aeb058d7d3ac81f13d.tar.bz2 gnumach-b325f426b367d813b23799aeb058d7d3ac81f13d.zip |
Optimize slab lookup on the free path
Caches that use external slab data but allocate slabs from the direct
physical mapping can look up slab data in constant time by associating
the slab data directly with the underlying page.
* kern/slab.c (kmem_slab_use_tree): Take KMEM_CF_DIRECTMAP into account.
(kmem_slab_create): Set page private data if relevant.
(kmem_slab_destroy): Clear page private data if relevant.
(kmem_cache_free_to_slab): Use page private data if relevant.
* vm/vm_page.c (vm_page_init_pa): Set `priv' member to NULL.
* vm/vm_page.h (vm_page_set_priv, vm_page_get_priv): New functions.
Diffstat (limited to 'vm/vm_page.h')
-rw-r--r-- | vm/vm_page.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/vm/vm_page.h b/vm/vm_page.h index 6f4f3c22..f2e20a78 100644 --- a/vm/vm_page.h +++ b/vm/vm_page.h @@ -82,6 +82,7 @@ struct vm_page { unsigned short type; unsigned short seg_index; unsigned short order; + void *priv; /* * This member is used throughout the code and may only change for @@ -424,6 +425,21 @@ vm_page_direct_ptr(const struct vm_page *page) #endif /* + * Associate private data with a page. + */ +static inline void +vm_page_set_priv(struct vm_page *page, void *priv) +{ + page->priv = priv; +} + +static inline void * +vm_page_get_priv(const struct vm_page *page) +{ + return page->priv; +} + +/* * Load physical memory into the vm_page module at boot time. * * The avail_start and avail_end parameters are used to maintain a simple |