diff options
author | Richard Braun <rbraun@sceen.net> | 2012-12-07 20:29:45 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2012-12-07 20:29:45 +0100 |
commit | 80f72c03069a8347ba43e127b21ffdc7d33823d3 (patch) | |
tree | 05ee662ff67babd4b875121214f06dc06f88aa4f /vm | |
parent | 4da4afcdd6a7e44205a0ba0fd609c98c75cf1826 (diff) |
kern/kmem: rework buffer-to-slab lookup
Instead of using a red-black tree, rely on the VM system to store kmem
specific private data.
Diffstat (limited to 'vm')
-rw-r--r-- | vm/vm_kmem.c | 13 | ||||
-rw-r--r-- | vm/vm_kmem.h | 6 | ||||
-rw-r--r-- | vm/vm_page.h | 1 | ||||
-rw-r--r-- | vm/vm_phys.c | 1 |
4 files changed, 21 insertions, 0 deletions
diff --git a/vm/vm_kmem.c b/vm/vm_kmem.c index d51b2ced..5cc7374a 100644 --- a/vm/vm_kmem.c +++ b/vm/vm_kmem.c @@ -80,6 +80,19 @@ vm_kmem_boot_space(unsigned long *start, unsigned long *end) *end = vm_kmem_boot_start; } +struct vm_page * +vm_kmem_lookup_page(unsigned long va) +{ + phys_addr_t pa; + + pa = pmap_kextract(va); + + if (pa == 0) + return NULL; + + return vm_phys_lookup_page(pa); +} + static int vm_kmem_alloc_check(size_t size) { diff --git a/vm/vm_kmem.h b/vm/vm_kmem.h index 6ecf8e17..d0da49f3 100644 --- a/vm/vm_kmem.h +++ b/vm/vm_kmem.h @@ -52,6 +52,12 @@ unsigned long vm_kmem_bootalloc(size_t size); void vm_kmem_boot_space(unsigned long *start, unsigned long *end); /* + * Return the page descriptor for the physical page mapped at va in kernel + * space. The given address must be mapped and valid. + */ +struct vm_page * vm_kmem_lookup_page(unsigned long va); + +/* * Allocate memory from the kernel map. */ unsigned long vm_kmem_alloc(size_t size); diff --git a/vm/vm_page.h b/vm/vm_page.h index e5ad8fc5..205f3d2f 100644 --- a/vm/vm_page.h +++ b/vm/vm_page.h @@ -42,6 +42,7 @@ struct vm_page { unsigned short seg_index; unsigned short order; phys_addr_t phys_addr; + void *slab_priv; }; static inline phys_addr_t diff --git a/vm/vm_phys.c b/vm/vm_phys.c index 14abf90e..cba286a2 100644 --- a/vm/vm_phys.c +++ b/vm/vm_phys.c @@ -155,6 +155,7 @@ vm_phys_init_page(struct vm_page *page, unsigned short seg_index, page->seg_index = seg_index; page->order = order; page->phys_addr = pa; + page->slab_priv = NULL; } static void __init |