-/* $OpenBSD: uvm.h,v 1.60 2015/10/08 15:58:38 kettenis Exp $ */
+/* $OpenBSD: uvm.h,v 1.61 2016/08/11 01:17:33 dlg Exp $ */
/* $NetBSD: uvm.h,v 1.24 2000/11/27 08:40:02 chs Exp $ */
/*
struct mutex aiodoned_lock;
/* static kernel map entry pool */
- vm_map_entry_t kentry_free; /* free page pool */
+ SLIST_HEAD(, vm_map_entry) kentry_free; /* free page pool */
/* aio_done is locked by uvm.aiodoned_lock. */
TAILQ_HEAD(, buf) aio_done; /* done async i/o reqs */
-/* $OpenBSD: uvm_map.c,v 1.219 2016/07/30 16:43:44 kettenis Exp $ */
+/* $OpenBSD: uvm_map.c,v 1.220 2016/08/11 01:17:33 dlg Exp $ */
/* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */
/*
if (map->flags & VM_MAP_INTRSAFE || cold) {
mtx_enter(&uvm_kmapent_mtx);
- me = uvm.kentry_free;
- if (me == NULL) {
+ if (SLIST_EMPTY(&uvm.kentry_free)) {
ne = km_alloc(PAGE_SIZE, &kv_page, &kp_dirty,
&kd_nowait);
if (ne == NULL)
panic("uvm_mapent_alloc: cannot allocate map "
"entry");
- for (i = 0;
- i < PAGE_SIZE / sizeof(struct vm_map_entry) - 1;
- i++)
- RB_LEFT(&ne[i], daddrs.addr_entry) = &ne[i + 1];
- RB_LEFT(&ne[i], daddrs.addr_entry) = NULL;
- me = ne;
+ for (i = 0; i < PAGE_SIZE / sizeof(*ne); i++) {
+ SLIST_INSERT_HEAD(&uvm.kentry_free,
+ &ne[i], daddrs.addr_kentry);
+ }
if (ratecheck(&uvm_kmapent_last_warn_time,
&uvm_kmapent_warn_rate))
printf("uvm_mapent_alloc: out of static "
"map entries\n");
}
- uvm.kentry_free = RB_LEFT(me, daddrs.addr_entry);
+ me = SLIST_FIRST(&uvm.kentry_free);
+ SLIST_REMOVE_HEAD(&uvm.kentry_free, daddrs.addr_kentry);
uvmexp.kmapent++;
mtx_leave(&uvm_kmapent_mtx);
me->flags = UVM_MAP_STATIC;
{
if (me->flags & UVM_MAP_STATIC) {
mtx_enter(&uvm_kmapent_mtx);
- RB_LEFT(me, daddrs.addr_entry) = uvm.kentry_free;
- uvm.kentry_free = me;
+ SLIST_INSERT_HEAD(&uvm.kentry_free, me, daddrs.addr_kentry);
uvmexp.kmapent--;
mtx_leave(&uvm_kmapent_mtx);
} else if (me->flags & UVM_MAP_KMEM) {
/* now set up static pool of kernel map entries ... */
mtx_init(&uvm_kmapent_mtx, IPL_VM);
- uvm.kentry_free = NULL;
+ SLIST_INIT(&uvm.kentry_free);
for (lcv = 0 ; lcv < MAX_KMAPENT ; lcv++) {
- RB_LEFT(&kernel_map_entry[lcv], daddrs.addr_entry) =
- uvm.kentry_free;
- uvm.kentry_free = &kernel_map_entry[lcv];
+ SLIST_INSERT_HEAD(&uvm.kentry_free,
+ &kernel_map_entry[lcv], daddrs.addr_kentry);
}
/* initialize the map-related pools. */