vm_kern.c (331722) | vm_kern.c (337262) |
---|---|
1/*- 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * The Mach Operating System project at Carnegie-Mellon University. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 49 unchanged lines hidden (view full) --- 58 * rights to redistribute these changes. 59 */ 60 61/* 62 * Kernel memory management. 63 */ 64 65#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * The Mach Operating System project at Carnegie-Mellon University. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 49 unchanged lines hidden (view full) --- 58 * rights to redistribute these changes. 59 */ 60 61/* 62 * Kernel memory management. 63 */ 64 65#include <sys/cdefs.h> |
66__FBSDID("$FreeBSD: stable/11/sys/vm/vm_kern.c 331722 2018-03-29 02:50:57Z eadler $"); | 66__FBSDID("$FreeBSD: stable/11/sys/vm/vm_kern.c 337262 2018-08-03 15:42:39Z markj $"); |
67 68#include <sys/param.h> 69#include <sys/systm.h> 70#include <sys/kernel.h> /* for ticks and hz */ 71#include <sys/eventhandler.h> 72#include <sys/lock.h> 73#include <sys/proc.h> 74#include <sys/malloc.h> --- 4 unchanged lines hidden (view full) --- 79#include <vm/vm.h> 80#include <vm/vm_param.h> 81#include <vm/vm_kern.h> 82#include <vm/pmap.h> 83#include <vm/vm_map.h> 84#include <vm/vm_object.h> 85#include <vm/vm_page.h> 86#include <vm/vm_pageout.h> | 67 68#include <sys/param.h> 69#include <sys/systm.h> 70#include <sys/kernel.h> /* for ticks and hz */ 71#include <sys/eventhandler.h> 72#include <sys/lock.h> 73#include <sys/proc.h> 74#include <sys/malloc.h> --- 4 unchanged lines hidden (view full) --- 79#include <vm/vm.h> 80#include <vm/vm_param.h> 81#include <vm/vm_kern.h> 82#include <vm/pmap.h> 83#include <vm/vm_map.h> 84#include <vm/vm_object.h> 85#include <vm/vm_page.h> 86#include <vm/vm_pageout.h> |
87#include <vm/vm_phys.h> |
|
87#include <vm/vm_radix.h> 88#include <vm/vm_extern.h> 89#include <vm/uma.h> 90 91vm_map_t kernel_map; 92vm_map_t exec_map; 93vm_map_t pipe_map; 94 --- 437 unchanged lines hidden (view full) --- 532#else 533 VM_MIN_KERNEL_ADDRESS, 534#endif 535 start, VM_PROT_ALL, VM_PROT_ALL, MAP_NOFAULT); 536 /* ... and ending with the completion of the above `insert' */ 537 vm_map_unlock(m); 538} 539 | 88#include <vm/vm_radix.h> 89#include <vm/vm_extern.h> 90#include <vm/uma.h> 91 92vm_map_t kernel_map; 93vm_map_t exec_map; 94vm_map_t pipe_map; 95 --- 437 unchanged lines hidden (view full) --- 533#else 534 VM_MIN_KERNEL_ADDRESS, 535#endif 536 start, VM_PROT_ALL, VM_PROT_ALL, MAP_NOFAULT); 537 /* ... and ending with the completion of the above `insert' */ 538 vm_map_unlock(m); 539} 540 |
541/* 542 * kmem_bootstrap_free: 543 * 544 * Free pages backing preloaded data (e.g., kernel modules) to the 545 * system. Currently only supported on platforms that create a 546 * vm_phys segment for preloaded data. 547 */ 548void 549kmem_bootstrap_free(vm_offset_t start, vm_size_t size) 550{ 551#if defined(__i386__) || defined(__amd64__) 552 vm_offset_t end, va; 553 vm_paddr_t pa; 554 vm_page_t m; 555 556 end = trunc_page(start + size); 557 start = round_page(start); 558 559 for (va = start; va < end; va += PAGE_SIZE) { 560 pa = pmap_kextract(va); 561 m = PHYS_TO_VM_PAGE(pa); 562 563 mtx_lock(&vm_page_queue_free_mtx); 564 vm_phys_free_pages(m, 0); 565 mtx_unlock(&vm_page_queue_free_mtx); 566 } 567 pmap_remove(kernel_pmap, start, end); 568 (void)vmem_add(kernel_arena, start, end - start, M_WAITOK); 569#endif 570} 571 |
|
540#ifdef DIAGNOSTIC 541/* 542 * Allow userspace to directly trigger the VM drain routine for testing 543 * purposes. 544 */ 545static int 546debug_vm_lowmem(SYSCTL_HANDLER_ARGS) 547{ --- 16 unchanged lines hidden --- | 572#ifdef DIAGNOSTIC 573/* 574 * Allow userspace to directly trigger the VM drain routine for testing 575 * purposes. 576 */ 577static int 578debug_vm_lowmem(SYSCTL_HANDLER_ARGS) 579{ --- 16 unchanged lines hidden --- |