vm.c revision 1.80 1 /* $NetBSD: vm.c,v 1.80 2010/06/03 10:56:20 pooka Exp $ */
2
3 /*
4 * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved.
5 *
6 * Development of this software was supported by
7 * The Finnish Cultural Foundation and the Research Foundation of
8 * The Helsinki University of Technology.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
20 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 */
31
32 /*
33 * Virtual memory emulation routines. Contents:
34 * + anon objects & pager
35 * + misc support routines
36 */
37
38 /*
39 * XXX: we abuse pg->uanon for the virtual address of the storage
40 * for each page. phys_addr would fit the job description better,
41 * except that it will create unnecessary lossage on some platforms
42 * due to not being a pointer type.
43 */
44
45 #include <sys/cdefs.h>
46 __KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.80 2010/06/03 10:56:20 pooka Exp $");
47
48 #include <sys/param.h>
49 #include <sys/atomic.h>
50 #include <sys/buf.h>
51 #include <sys/kernel.h>
52 #include <sys/kmem.h>
53 #include <sys/mman.h>
54 #include <sys/null.h>
55 #include <sys/vnode.h>
56
57 #include <machine/pmap.h>
58
59 #include <rump/rumpuser.h>
60
61 #include <uvm/uvm.h>
62 #include <uvm/uvm_ddb.h>
63 #include <uvm/uvm_prot.h>
64 #include <uvm/uvm_readahead.h>
65
66 #include "rump_private.h"
67
68 static int ao_get(struct uvm_object *, voff_t, struct vm_page **,
69 int *, int, vm_prot_t, int, int);
70 static int ao_put(struct uvm_object *, voff_t, voff_t, int);
71
72 const struct uvm_pagerops aobj_pager = {
73 .pgo_get = ao_get,
74 .pgo_put = ao_put,
75 };
76
77 kmutex_t uvm_pageqlock;
78
79 struct uvmexp uvmexp;
80 struct uvm uvm;
81
82 struct vmspace rump_vmspace;
83 struct vm_map rump_vmmap;
84 static struct vm_map_kernel kmem_map_store;
85 struct vm_map *kmem_map = &kmem_map_store.vmk_map;
86 const struct rb_tree_ops uvm_page_tree_ops;
87
88 static struct vm_map_kernel kernel_map_store;
89 struct vm_map *kernel_map = &kernel_map_store.vmk_map;
90
91 static unsigned int pdaemon_waiters;
92 static kmutex_t pdaemonmtx;
93 static kcondvar_t pdaemoncv, oomwait;
94
95 /*
96 * vm pages
97 */
98
99 /* called with the object locked */
100 struct vm_page *
101 uvm_pagealloc_strat(struct uvm_object *uobj, voff_t off, struct vm_anon *anon,
102 int flags, int strat, int free_list)
103 {
104 struct vm_page *pg;
105
106 pg = kmem_zalloc(sizeof(struct vm_page), KM_SLEEP);
107 pg->offset = off;
108 pg->uobject = uobj;
109
110 pg->uanon = (void *)kmem_alloc(PAGE_SIZE, KM_SLEEP);
111 if (flags & UVM_PGA_ZERO)
112 memset(pg->uanon, 0, PAGE_SIZE);
113 pg->flags = PG_CLEAN|PG_BUSY|PG_FAKE;
114
115 TAILQ_INSERT_TAIL(&uobj->memq, pg, listq.queue);
116 uobj->uo_npages++;
117
118 return pg;
119 }
120
121 /*
122 * Release a page.
123 *
124 * Called with the vm object locked.
125 */
126 void
127 uvm_pagefree(struct vm_page *pg)
128 {
129 struct uvm_object *uobj = pg->uobject;
130
131 if (pg->flags & PG_WANTED)
132 wakeup(pg);
133
134 uobj->uo_npages--;
135 TAILQ_REMOVE(&uobj->memq, pg, listq.queue);
136 kmem_free((void *)pg->uanon, PAGE_SIZE);
137 kmem_free(pg, sizeof(*pg));
138 }
139
140 void
141 uvm_pagezero(struct vm_page *pg)
142 {
143
144 pg->flags &= ~PG_CLEAN;
145 memset((void *)pg->uanon, 0, PAGE_SIZE);
146 }
147
148 /*
149 * Anon object stuff
150 */
151
152 static int
153 ao_get(struct uvm_object *uobj, voff_t off, struct vm_page **pgs,
154 int *npages, int centeridx, vm_prot_t access_type,
155 int advice, int flags)
156 {
157 struct vm_page *pg;
158 int i;
159
160 if (centeridx)
161 panic("%s: centeridx != 0 not supported", __func__);
162
163 /* loop over pages */
164 off = trunc_page(off);
165 for (i = 0; i < *npages; i++) {
166 retrylookup:
167 pg = uvm_pagelookup(uobj, off + (i << PAGE_SHIFT));
168 if (pg) {
169 if (pg->flags & PG_BUSY) {
170 pg->flags |= PG_WANTED;
171 UVM_UNLOCK_AND_WAIT(pg, &uobj->vmobjlock, 0,
172 "aogetpg", 0);
173 goto retrylookup;
174 }
175 pg->flags |= PG_BUSY;
176 pgs[i] = pg;
177 } else {
178 pg = uvm_pagealloc(uobj,
179 off + (i << PAGE_SHIFT), NULL, UVM_PGA_ZERO);
180 pgs[i] = pg;
181 }
182 }
183 mutex_exit(&uobj->vmobjlock);
184
185 return 0;
186
187 }
188
189 static int
190 ao_put(struct uvm_object *uobj, voff_t start, voff_t stop, int flags)
191 {
192 struct vm_page *pg;
193
194 /* we only free all pages for now */
195 if ((flags & PGO_FREE) == 0 || (flags & PGO_ALLPAGES) == 0) {
196 mutex_exit(&uobj->vmobjlock);
197 return 0;
198 }
199
200 while ((pg = TAILQ_FIRST(&uobj->memq)) != NULL)
201 uvm_pagefree(pg);
202 mutex_exit(&uobj->vmobjlock);
203
204 return 0;
205 }
206
207 struct uvm_object *
208 uao_create(vsize_t size, int flags)
209 {
210 struct uvm_object *uobj;
211
212 uobj = kmem_zalloc(sizeof(struct uvm_object), KM_SLEEP);
213 uobj->pgops = &aobj_pager;
214 TAILQ_INIT(&uobj->memq);
215 mutex_init(&uobj->vmobjlock, MUTEX_DEFAULT, IPL_NONE);
216
217 return uobj;
218 }
219
220 void
221 uao_detach(struct uvm_object *uobj)
222 {
223
224 mutex_enter(&uobj->vmobjlock);
225 ao_put(uobj, 0, 0, PGO_ALLPAGES | PGO_FREE);
226 mutex_destroy(&uobj->vmobjlock);
227 kmem_free(uobj, sizeof(*uobj));
228 }
229
230 /*
231 * Misc routines
232 */
233
234 static kmutex_t pagermtx;
235
236 void
237 uvm_init(void)
238 {
239
240 uvmexp.free = 1024*1024; /* XXX */
241 rump_vmspace.vm_map.pmap = pmap_kernel();
242
243 mutex_init(&pagermtx, MUTEX_DEFAULT, 0);
244 mutex_init(&uvm_pageqlock, MUTEX_DEFAULT, 0);
245
246 mutex_init(&pdaemonmtx, MUTEX_DEFAULT, 0);
247 cv_init(&pdaemoncv, "pdaemon");
248 cv_init(&oomwait, "oomwait");
249
250 kernel_map->pmap = pmap_kernel();
251 callback_head_init(&kernel_map_store.vmk_reclaim_callback, IPL_VM);
252 kmem_map->pmap = pmap_kernel();
253 callback_head_init(&kmem_map_store.vmk_reclaim_callback, IPL_VM);
254 }
255
256
257 void
258 uvm_pagewire(struct vm_page *pg)
259 {
260
261 /* nada */
262 }
263
264 void
265 uvm_pageunwire(struct vm_page *pg)
266 {
267
268 /* nada */
269 }
270
271 /*
272 * This satisfies the "disgusting mmap hack" used by proplib.
273 * We probably should grow some more assertables to make sure we're
274 * not satisfying anything we shouldn't be satisfying. At least we
275 * should make sure it's the local machine we're mmapping ...
276 */
277 int
278 uvm_mmap(struct vm_map *map, vaddr_t *addr, vsize_t size, vm_prot_t prot,
279 vm_prot_t maxprot, int flags, void *handle, voff_t off, vsize_t locklim)
280 {
281 void *uaddr;
282 int error;
283
284 if (prot != (VM_PROT_READ | VM_PROT_WRITE))
285 panic("uvm_mmap() variant unsupported");
286 if (flags != (MAP_PRIVATE | MAP_ANON))
287 panic("uvm_mmap() variant unsupported");
288 /* no reason in particular, but cf. uvm_default_mapaddr() */
289 if (*addr != 0)
290 panic("uvm_mmap() variant unsupported");
291
292 uaddr = rumpuser_anonmmap(size, 0, 0, &error);
293 if (uaddr == NULL)
294 return error;
295
296 *addr = (vaddr_t)uaddr;
297 return 0;
298 }
299
300 struct pagerinfo {
301 vaddr_t pgr_kva;
302 int pgr_npages;
303 struct vm_page **pgr_pgs;
304 bool pgr_read;
305
306 LIST_ENTRY(pagerinfo) pgr_entries;
307 };
308 static LIST_HEAD(, pagerinfo) pagerlist = LIST_HEAD_INITIALIZER(pagerlist);
309
310 /*
311 * Pager "map" in routine. Instead of mapping, we allocate memory
312 * and copy page contents there. Not optimal or even strictly
313 * correct (the caller might modify the page contents after mapping
314 * them in), but what the heck. Assumes UVMPAGER_MAPIN_WAITOK.
315 */
316 vaddr_t
317 uvm_pagermapin(struct vm_page **pgs, int npages, int flags)
318 {
319 struct pagerinfo *pgri;
320 vaddr_t curkva;
321 int i;
322
323 /* allocate structures */
324 pgri = kmem_alloc(sizeof(*pgri), KM_SLEEP);
325 pgri->pgr_kva = (vaddr_t)kmem_alloc(npages * PAGE_SIZE, KM_SLEEP);
326 pgri->pgr_npages = npages;
327 pgri->pgr_pgs = kmem_alloc(sizeof(struct vm_page *) * npages, KM_SLEEP);
328 pgri->pgr_read = (flags & UVMPAGER_MAPIN_READ) != 0;
329
330 /* copy contents to "mapped" memory */
331 for (i = 0, curkva = pgri->pgr_kva;
332 i < npages;
333 i++, curkva += PAGE_SIZE) {
334 /*
335 * We need to copy the previous contents of the pages to
336 * the window even if we are reading from the
337 * device, since the device might not fill the contents of
338 * the full mapped range and we will end up corrupting
339 * data when we unmap the window.
340 */
341 memcpy((void*)curkva, pgs[i]->uanon, PAGE_SIZE);
342 pgri->pgr_pgs[i] = pgs[i];
343 }
344
345 mutex_enter(&pagermtx);
346 LIST_INSERT_HEAD(&pagerlist, pgri, pgr_entries);
347 mutex_exit(&pagermtx);
348
349 return pgri->pgr_kva;
350 }
351
352 /*
353 * map out the pager window. return contents from VA to page storage
354 * and free structures.
355 *
356 * Note: does not currently support partial frees
357 */
358 void
359 uvm_pagermapout(vaddr_t kva, int npages)
360 {
361 struct pagerinfo *pgri;
362 vaddr_t curkva;
363 int i;
364
365 mutex_enter(&pagermtx);
366 LIST_FOREACH(pgri, &pagerlist, pgr_entries) {
367 if (pgri->pgr_kva == kva)
368 break;
369 }
370 KASSERT(pgri);
371 if (pgri->pgr_npages != npages)
372 panic("uvm_pagermapout: partial unmapping not supported");
373 LIST_REMOVE(pgri, pgr_entries);
374 mutex_exit(&pagermtx);
375
376 if (pgri->pgr_read) {
377 for (i = 0, curkva = pgri->pgr_kva;
378 i < pgri->pgr_npages;
379 i++, curkva += PAGE_SIZE) {
380 memcpy(pgri->pgr_pgs[i]->uanon,(void*)curkva,PAGE_SIZE);
381 }
382 }
383
384 kmem_free(pgri->pgr_pgs, npages * sizeof(struct vm_page *));
385 kmem_free((void*)pgri->pgr_kva, npages * PAGE_SIZE);
386 kmem_free(pgri, sizeof(*pgri));
387 }
388
389 /*
390 * convert va in pager window to page structure.
391 * XXX: how expensive is this (global lock, list traversal)?
392 */
393 struct vm_page *
394 uvm_pageratop(vaddr_t va)
395 {
396 struct pagerinfo *pgri;
397 struct vm_page *pg = NULL;
398 int i;
399
400 mutex_enter(&pagermtx);
401 LIST_FOREACH(pgri, &pagerlist, pgr_entries) {
402 if (pgri->pgr_kva <= va
403 && va < pgri->pgr_kva + pgri->pgr_npages*PAGE_SIZE)
404 break;
405 }
406 if (pgri) {
407 i = (va - pgri->pgr_kva) >> PAGE_SHIFT;
408 pg = pgri->pgr_pgs[i];
409 }
410 mutex_exit(&pagermtx);
411
412 return pg;
413 }
414
415 /* Called with the vm object locked */
416 struct vm_page *
417 uvm_pagelookup(struct uvm_object *uobj, voff_t off)
418 {
419 struct vm_page *pg;
420
421 TAILQ_FOREACH(pg, &uobj->memq, listq.queue) {
422 if (pg->offset == off) {
423 return pg;
424 }
425 }
426
427 return NULL;
428 }
429
430 void
431 uvm_page_unbusy(struct vm_page **pgs, int npgs)
432 {
433 struct vm_page *pg;
434 int i;
435
436 for (i = 0; i < npgs; i++) {
437 pg = pgs[i];
438 if (pg == NULL)
439 continue;
440
441 KASSERT(pg->flags & PG_BUSY);
442 if (pg->flags & PG_WANTED)
443 wakeup(pg);
444 if (pg->flags & PG_RELEASED)
445 uvm_pagefree(pg);
446 else
447 pg->flags &= ~(PG_WANTED|PG_BUSY);
448 }
449 }
450
451 void
452 uvm_estimatepageable(int *active, int *inactive)
453 {
454
455 /* XXX: guessing game */
456 *active = 1024;
457 *inactive = 1024;
458 }
459
460 struct vm_map_kernel *
461 vm_map_to_kernel(struct vm_map *map)
462 {
463
464 return (struct vm_map_kernel *)map;
465 }
466
467 bool
468 vm_map_starved_p(struct vm_map *map)
469 {
470
471 if (map->flags & VM_MAP_WANTVA)
472 return true;
473
474 return false;
475 }
476
477 int
478 uvm_loan(struct vm_map *map, vaddr_t start, vsize_t len, void *v, int flags)
479 {
480
481 panic("%s: unimplemented", __func__);
482 }
483
484 void
485 uvm_unloan(void *v, int npages, int flags)
486 {
487
488 panic("%s: unimplemented", __func__);
489 }
490
491 int
492 uvm_loanuobjpages(struct uvm_object *uobj, voff_t pgoff, int orignpages,
493 struct vm_page **opp)
494 {
495
496 return EBUSY;
497 }
498
499 #ifdef DEBUGPRINT
500 void
501 uvm_object_printit(struct uvm_object *uobj, bool full,
502 void (*pr)(const char *, ...))
503 {
504
505 pr("VM OBJECT at %p, refs %d", uobj, uobj->uo_refs);
506 }
507 #endif
508
509 vaddr_t
510 uvm_default_mapaddr(struct proc *p, vaddr_t base, vsize_t sz)
511 {
512
513 return 0;
514 }
515
516 int
517 uvm_map_protect(struct vm_map *map, vaddr_t start, vaddr_t end,
518 vm_prot_t prot, bool set_max)
519 {
520
521 return EOPNOTSUPP;
522 }
523
524 /*
525 * UVM km
526 */
527
528 vaddr_t
529 uvm_km_alloc(struct vm_map *map, vsize_t size, vsize_t align, uvm_flag_t flags)
530 {
531 void *rv;
532 int alignbit, error;
533
534 alignbit = 0;
535 if (align) {
536 alignbit = ffs(align)-1;
537 }
538
539 rv = rumpuser_anonmmap(size, alignbit, flags & UVM_KMF_EXEC, &error);
540 if (rv == NULL) {
541 if (flags & (UVM_KMF_CANFAIL | UVM_KMF_NOWAIT))
542 return 0;
543 else
544 panic("uvm_km_alloc failed");
545 }
546
547 if (flags & UVM_KMF_ZERO)
548 memset(rv, 0, size);
549
550 return (vaddr_t)rv;
551 }
552
553 void
554 uvm_km_free(struct vm_map *map, vaddr_t vaddr, vsize_t size, uvm_flag_t flags)
555 {
556
557 rumpuser_unmap((void *)vaddr, size);
558 }
559
560 struct vm_map *
561 uvm_km_suballoc(struct vm_map *map, vaddr_t *minaddr, vaddr_t *maxaddr,
562 vsize_t size, int pageable, bool fixed, struct vm_map_kernel *submap)
563 {
564
565 return (struct vm_map *)417416;
566 }
567
568 vaddr_t
569 uvm_km_alloc_poolpage(struct vm_map *map, bool waitok)
570 {
571
572 return (vaddr_t)rump_hypermalloc(PAGE_SIZE, PAGE_SIZE,
573 waitok, "kmalloc");
574 }
575
576 void
577 uvm_km_free_poolpage(struct vm_map *map, vaddr_t addr)
578 {
579
580 rumpuser_free((void *)addr);
581 }
582
583 vaddr_t
584 uvm_km_alloc_poolpage_cache(struct vm_map *map, bool waitok)
585 {
586
587 return uvm_km_alloc_poolpage(map, waitok);
588 }
589
590 void
591 uvm_km_free_poolpage_cache(struct vm_map *map, vaddr_t vaddr)
592 {
593
594 uvm_km_free_poolpage(map, vaddr);
595 }
596
597 void
598 uvm_km_va_drain(struct vm_map *map, uvm_flag_t flags)
599 {
600
601 /* we eventually maybe want some model for available memory */
602 }
603
604 /*
605 * Mapping and vm space locking routines.
606 * XXX: these don't work for non-local vmspaces
607 */
608 int
609 uvm_vslock(struct vmspace *vs, void *addr, size_t len, vm_prot_t access)
610 {
611
612 KASSERT(vs == &rump_vmspace);
613 return 0;
614 }
615
616 void
617 uvm_vsunlock(struct vmspace *vs, void *addr, size_t len)
618 {
619
620 KASSERT(vs == &rump_vmspace);
621 }
622
623 void
624 vmapbuf(struct buf *bp, vsize_t len)
625 {
626
627 bp->b_saveaddr = bp->b_data;
628 }
629
630 void
631 vunmapbuf(struct buf *bp, vsize_t len)
632 {
633
634 bp->b_data = bp->b_saveaddr;
635 bp->b_saveaddr = 0;
636 }
637
638 void
639 uvmspace_free(struct vmspace *vm)
640 {
641
642 /* nothing for now */
643 }
644
645 int
646 uvm_io(struct vm_map *map, struct uio *uio)
647 {
648
649 /*
650 * just do direct uio for now. but this needs some vmspace
651 * olympics for rump_sysproxy.
652 */
653 return uiomove((void *)(vaddr_t)uio->uio_offset, uio->uio_resid, uio);
654 }
655
656 /*
657 * page life cycle stuff. it really doesn't exist, so just stubs.
658 */
659
660 void
661 uvm_pageactivate(struct vm_page *pg)
662 {
663
664 /* nada */
665 }
666
667 void
668 uvm_pagedeactivate(struct vm_page *pg)
669 {
670
671 /* nada */
672 }
673
674 void
675 uvm_pagedequeue(struct vm_page *pg)
676 {
677
678 /* nada*/
679 }
680
681 void
682 uvm_pageenqueue(struct vm_page *pg)
683 {
684
685 /* nada */
686 }
687
688 /*
689 * Routines related to the Page Baroness.
690 */
691
692 void
693 uvm_wait(const char *msg)
694 {
695
696 if (__predict_false(curlwp == uvm.pagedaemon_lwp))
697 panic("pagedaemon out of memory");
698 if (__predict_false(rump_threads == 0))
699 panic("pagedaemon missing (RUMP_THREADS = 0)");
700
701 mutex_enter(&pdaemonmtx);
702 pdaemon_waiters++;
703 cv_signal(&pdaemoncv);
704 cv_wait(&oomwait, &pdaemonmtx);
705 mutex_exit(&pdaemonmtx);
706 }
707
708 void
709 uvm_pageout_start(int npages)
710 {
711
712 /* we don't have the heuristics */
713 }
714
715 void
716 uvm_pageout_done(int npages)
717 {
718
719 /* could wakeup waiters, but just let the pagedaemon do it */
720 }
721
722 /*
723 * Under-construction page mistress. This is lacking vfs support, namely:
724 *
725 * 1) draining vfs buffers
726 * 2) paging out pages in vm vnode objects
727 * (we will not page out anon memory on the basis that
728 * that's the task of the host)
729 */
730
731 void
732 uvm_pageout(void *arg)
733 {
734 struct pool *pp, *pp_first;
735 uint64_t where;
736 int timo = 0;
737 bool succ;
738
739 mutex_enter(&pdaemonmtx);
740 for (;;) {
741 cv_timedwait(&pdaemoncv, &pdaemonmtx, timo);
742 uvmexp.pdwoke++;
743 kernel_map->flags |= VM_MAP_WANTVA;
744 mutex_exit(&pdaemonmtx);
745
746 succ = false;
747 pool_drain_start(&pp_first, &where);
748 pp = pp_first;
749 for (;;) {
750 succ = pool_drain_end(pp, where);
751 if (succ)
752 break;
753 pool_drain_start(&pp, &where);
754 if (pp == pp_first) {
755 succ = pool_drain_end(pp, where);
756 break;
757 }
758 }
759 mutex_enter(&pdaemonmtx);
760
761 if (!succ) {
762 rumpuser_dprintf("pagedaemoness: failed to reclaim "
763 "memory ... sleeping (deadlock?)\n");
764 timo = hz;
765 continue;
766 }
767 kernel_map->flags &= ~VM_MAP_WANTVA;
768 timo = 0;
769
770 if (pdaemon_waiters) {
771 pdaemon_waiters = 0;
772 cv_broadcast(&oomwait);
773 }
774 }
775
776 panic("you can swap out any time you like, but you can never leave");
777 }
778
779 /*
780 * In a regular kernel the pagedaemon is activated when memory becomes
781 * low. In a virtual rump kernel we do not know exactly how much memory
782 * we have available -- it depends on the conditions on the host.
783 * Therefore, we cannot preemptively kick the pagedaemon. Rather, we
784 * wait until things we desperate and we're forced to uvm_wait().
785 *
786 * The alternative would be to allocate a huge chunk of memory at
787 * startup, but that solution has a number of problems including
788 * being a resource hog, failing anyway due to host memory overcommit
789 * and core dump size.
790 */
791
792 void
793 uvm_kick_pdaemon()
794 {
795
796 /* nada */
797 }
798
799 void *
800 rump_hypermalloc(size_t howmuch, int alignment, bool waitok, const char *wmsg)
801 {
802 void *rv;
803
804 again:
805 rv = rumpuser_malloc(howmuch, alignment);
806 if (__predict_false(rv == NULL && waitok)) {
807 uvm_wait(wmsg);
808 goto again;
809 }
810
811 return rv;
812 }
813