aboutsummaryrefslogtreecommitdiff
path: root/vm
Commit message (Collapse)AuthorAgeFilesLines
* vm: collapse unreachable branch into assertionJustus Winter2015-08-181-28/+3
| | | | | * vm/vm_object.c (vm_object_collapse): Collapse unreachable branch into assertion.
* vm: fix compiler warningJustus Winter2015-08-151-3/+0
| | | | * vm/vm_user.c (vm_wire): Drop unused but set variable `host'.
* vm: enable extra assertionsJustus Winter2015-08-151-2/+0
| | | | * vm/vm_fault.c (vm_fault_page): Enable extra assertions.
* vm: really fix traversing the list of inactive pagesJustus Winter2015-07-121-1/+1
| | | | | | | | Previously, the pageout code traversed the list of pages in an object instead of the list of inactive pages. * vm/vm_pageout.c (vm_pageout_scan): Fix traversing the list of inactive pages.
* vm: fix traversing the list of inactive pagesJustus Winter2015-07-111-1/+1
| | | | | | | | | | Previously, the pageout code traversed the hash table chain instead of the list of inactive pages. The code merely compiled by accident, because the `struct page' also has a field called `next' for the hash table chain. * vm/vm_pageout.c (vm_pageout_scan): Fix traversing the list of inactive pages.
* vm: drop debugging remnantsJustus Winter2015-07-101-10/+0
| | | | * vm/vm_object.c (vm_object_terminate): Drop debugging remnants.
* vm: fix panic messageJustus Winter2015-07-091-2/+1
| | | | * vm/vm_kern.c (kmem_init): Fix panic message.
* Allow non-privileged tasks to wire 64KiB task memorySamuel Thibault2015-07-093-3/+40
| | | | | | | | | | | | | | | | | * doc/mach.texi (vm_wire): Document that the host port does not have to be privileged. * include/mach/mach_hosts.defs (vm_wire): Use mach_port_t instead of host_priv_t. * vm/vm_map.h (vm_map): Add user_wired field. * vm/vm_map.c (vm_map_setup): Initialize user_wired field to 0. (vm_map_pageable_common, vm_map_entry_delete, vm_map_copy_overwrite, vm_map_copyout_page_list, vm_map_copyin_page_list): When switching user_wired_count field of entry between 0 and non-0, accumulate the corresponding size into the user_wired field of map. * vm/vm_user.c (vm_wire): Turn host parameter into port parameter, and inline a version of convert_port_to_host_priv which records whether the host port is privileged or not. When it is not privileged, check whether the additional amount to user_wired will overcome 64KiB.
* Fix typoFlávio Cruz2015-06-051-1/+1
| | | | * vm/vm_kern.c (kmem_alloc_aligned): Fix typo.
* vm: drop unused `kmem_realloc'Justus Winter2015-05-232-103/+1
| | | | | | * vm/vm_kern.c (kmem_realloc): Remove function. (kmem_alloc_wired): Adopt comment. * vm/vm_kern.h (kmem_realloc): Remove declaration.
* vm: gracefully handle resource shortageJustus Winter2015-05-201-14/+12
| | | | | | * vm/vm_object.c (vm_object_copy_call): Gracefully handle resource shortage by doing the allocation earlier and aborting the function if unsuccessful.
* kern: import `macros.h' from x15Justus Winter2015-05-194-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Import the macro definitions from the x15 kernel project, and replace all similar definitions littered all over the place with it. Importing this file will make importing code from the x15 kernel easier. We are already using the red-black tree implementation and the slab allocator from it, and we will import even more code in the near future. * kern/list.h: Do not define `structof', include `macros.h' instead. * kern/rbtree.h: Likewise. * kern/slab.c: Do not define `ARRAY_SIZE', include `macros.h' instead. * i386/grub/misc.h: Likewise. * i386/i386/xen.h: Do not define `barrier', include `macros.h' instead. * kern/macro_help.h: Delete file. Replaced by `macros.h'. * kern/macros.h: New file. * Makefrag.am (libkernel_a_SOURCES): Add new file, remove old file. * device/dev_master.h: Adopt accordingly. * device/io_req.h: Likewise. * device/net_io.h: Likewise. * i386/intel/read_fault.c: Likewise. * ipc/ipc_kmsg.h: Likewise. * ipc/ipc_mqueue.h: Likewise. * ipc/ipc_object.h: Likewise. * ipc/ipc_port.h: Likewise. * ipc/ipc_space.h: Likewise. * ipc/ipc_splay.c: Likewise. * ipc/ipc_splay.h: Likewise. * kern/assert.h: Likewise. * kern/ast.h: Likewise. * kern/pc_sample.h: Likewise. * kern/refcount.h: Likewise. * kern/sched.h: Likewise. * kern/sched_prim.c: Likewise. * kern/timer.c: Likewise. * kern/timer.h: Likewise. * vm/vm_fault.c: Likewise. * vm/vm_map.h: Likewise. * vm/vm_object.h: Likewise. * vm/vm_page.h: Likewise.
* kern: avoid #if 0ing out thread_collect_scanJustus Winter2015-02-181-0/+2
| | | | | | | | | | | | | Currently, `thread_collect_scan' does nothing because `pcb_collect' is a nop. Its body is exempt from compilation by means of the preprocessor. This is unfortunate as it increases the risk of bitrot, and we still need to pay the price of rate-limiting thread_collect_scan. * kern/thread.c (thread_collect_scan): Drop #if 0 around the body. * vm/vm_pageout.c (vm_pageout_scan): Do not call `consider_thread_collect' and document why.
* vm: fix typoJustus Winter2015-02-181-1/+1
| | | | * vm/vm_resident.c: Fix typo.
* vm: Fix typo in comment (found by codespell)Stefan Weil2015-01-021-1/+1
| | | | Signed-off-by: Stefan Weil <sw@weilnetz.de>
* Revert "Make vm_map really ignore `address' when `anywhere' is true"Samuel Thibault2014-11-101-4/+1
| | | | This reverts commit 5ae510e35c54009626999a88f0f1cb34d6dfc94f.
* Make vm_map really ignore `address' when `anywhere' is trueSamuel Thibault2014-09-061-1/+4
| | | | | | | As vm_allocate does. * vm/vm_user.c (vm_map): When `anywhere' is true, set `address' to the minimum address of the `target_map'.
* Tune pageout parametersSamuel Thibault2014-08-301-5/+5
| | | | | | | | | | | | This targets having always at least 8% free memory instead of just 1%. This has shown improving buildd stability a lot. Also increase the reserved amount to nowadays standards. * vm/vm_pageout.c (VM_PAGE_FREE_TARGET): Increase to 10%. (VM_PAGE_FREE_MIN): Increase to 8%. (VM_PAGE_FREE_RESERVED): Increase to 500 pages. (VM_PAGEOUT_RESERVED_INTERNAL): Increase to 150 pages. (VM_PAGEOUT_RESERVED_REALLY): Increase to 100 pages.
* Increate the pageout thread prioritySamuel Thibault2014-08-301-0/+1
| | | | * vm/vm_pageout.c (vm_pageout): Set the priority to 0.
* vm: make struct vm_map fit into a cache lineJustus Winter2014-04-301-2/+5
| | | | | | | | Currently, the size of struct vm_map is 68 bytes. By using a bit field for the boolean flags, it can be made fit into a cache line. * vm/vm_map.h (struct vm_map): Use a bit field for the boolean flags wait_for_space and wiring_required.
* Convert from K&R to ANSIMarin Ramesa2014-04-048-494/+454
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Convert from K&R style function definitions to ANSI style function definitions. * ddb/db_access.c: Convert function prototypes from K&R to ANSI. * ddb/db_aout.c: Likewise. * ddb/db_break.c: Likewise. * ddb/db_command.c: Likewise. * ddb/db_cond.c: Likewise. * ddb/db_examine.c: Likewise. * ddb/db_expr.c: Likewise. * ddb/db_ext_symtab.c: Likewise. * ddb/db_input.c: Likewise. * ddb/db_lex.c: Likewise. * ddb/db_macro.c: Likewise. * ddb/db_mp.c: Likewise. * ddb/db_output.c: Likewise. * ddb/db_print.c: Likewise. * ddb/db_run.c: Likewise. * ddb/db_sym.c: Likewise. * ddb/db_task_thread.c: Likewise. * ddb/db_trap.c: Likewise. * ddb/db_variables.c: Likewise. * ddb/db_watch.c: Likewise. * device/blkio.c: Likewise. * device/chario.c: Likewise. * device/dev_lookup.c: Likewise. * device/dev_name.c: Likewise. * device/dev_pager.c: Likewise. * device/ds_routines.c: Likewise. * device/net_io.c: Likewise. * device/subrs.c: Likewise. * i386/i386/db_interface.c: Likewise. * i386/i386/fpu.c: Likewise. * i386/i386/io_map.c: Likewise. * i386/i386/loose_ends.c: Likewise. * i386/i386/mp_desc.c: Likewise. * i386/i386/pcb.c: Likewise. * i386/i386/phys.c: Likewise. * i386/i386/trap.c: Likewise. * i386/i386/user_ldt.c: Likewise. * i386/i386at/com.c: Likewise. * i386/i386at/kd.c: Likewise. * i386/i386at/kd_event.c: Likewise. * i386/i386at/kd_mouse.c: Likewise. * i386/i386at/kd_queue.c: Likewise. * i386/i386at/lpr.c: Likewise. * i386/i386at/model_dep.c: Likewise. * i386/i386at/rtc.c: Likewise. * i386/intel/pmap.c: Likewise. * i386/intel/read_fault.c: Likewise. * ipc/ipc_entry.c: Likewise. * ipc/ipc_hash.c: Likewise. * ipc/ipc_kmsg.c: Likewise. * ipc/ipc_marequest.c: Likewise. * ipc/ipc_mqueue.c: Likewise. * ipc/ipc_notify.c: Likewise. * ipc/ipc_port.c: Likewise. * ipc/ipc_right.c: Likewise. * ipc/mach_debug.c: Likewise. * ipc/mach_msg.c: Likewise. * ipc/mach_port.c: Likewise. * ipc/mach_rpc.c: Likewise. * kern/act.c: Likewise. * kern/exception.c: Likewise. * kern/ipc_mig.c: Likewise. * kern/ipc_tt.c: Likewise. * kern/lock_mon.c: Likewise. * kern/mach_clock.c: Likewise. * kern/machine.c: Likewise. * kern/printf.c: Likewise. * kern/priority.c: Likewise. * kern/startup.c: Likewise. * kern/syscall_emulation.c: Likewise. * kern/syscall_subr.c: Likewise. * kern/thread_swap.c: Likewise. * kern/time_stamp.c: Likewise. * kern/timer.c: Likewise. * kern/xpr.c: Likewise. * vm/memory_object.c: Likewise. * vm/vm_debug.c: Likewise. * vm/vm_external.c: Likewise. * vm/vm_fault.c: Likewise. * vm/vm_kern.c: Likewise. * vm/vm_map.c: Likewise. * vm/vm_pageout.c: Likewise. * vm/vm_user.c: Likewise.
* vm: trigger garbage collection on kernel memory pressureRichard Braun2014-02-061-3/+48
| | | | | | | | | | | | | In addition to physical pages, the slab allocator also consumes kernel virtual memory, so reclaim pages on failure to allocate from a kernel map. This method isn't foolproof but helps alleviate fragmentation. * vm/vm_kern.c (kmem_alloc): Call slab_collect and retry allocation once on failure. (kmem_realloc): Likewise. (kmem_alloc_wired): Likewise. (kmem_alloc_wired): Likewise. (kmem_alloc_aligned): Likewise.
* Fix potential NULL dereferenceSamuel Thibault2014-02-041-2/+4
| | | | | * vm/vm_kern.c (projected_buffer_deallocate): Look for `map' being NULL or kernel_map before locking it.
* vm: remove the declaration of memory_object_create_proxyJustus Winter2014-01-161-11/+0
| | | | | | | | It is not clear to me why the declaration was put there in the first place. It is not used anywhere, and it conflicts with the declaration generated by mig. * vm/memory_object_proxy.h (memory_object_create_proxy): Remove declaration.
* vm: reduce the size of struct vm_pageJustus Winter2014-01-031-1/+1
| | | | | | | | | Previously, the bit field left 31 bits unused. By reducing the size of wire_count by one bit, the size of the whole struct is reduced by four bytes. * vm/vm_page.h (struct vm_page): Reduce the size of wire_count to 15 bits.
* vm: merge the two bit fields in struct vm_pageJustus Winter2014-01-031-7/+3
| | | | * vm/vm_page.h (struct vm_page): Merge the two bit fields.
* vm: remove NS32000-specific padding from struct vm_pageJustus Winter2014-01-031-3/+0
| | | | | | | Apparently, the NS32000 was a 32-bit CPU from the 1990ies. The string "ns32000" appears nowhere else in the source. * vm/vm_page.h (struct vm_page): Remove NS32000-specific padding.
* Declare void argument lists (part 2)Marin Ramesa2013-12-202-2/+2
| | | | | | | | Declare void argument lists that were not declared in the first part of this patch and * kern/sched_prim.h (recompute_priorities): Fix prototype. * kern/startup.c (setup_main) (recompute_priorities): Fix call.
* Mark functions that don't return with attribute noreturnMarin Ramesa2013-12-171-3/+3
|
* vm: qualify pointers whose dereferenced values are constant with constMarin Ramesa2013-12-179-21/+21
|
* vm/vm_resident.c (vm_page_print): remove unnecessary castsMarin Ramesa2013-12-151-2/+2
| | | | | | Members offset and phys_addr are of vm_offset_t types. * vm/vm_resident.c (vm_page_print) (offset, phys_addr): Remove unnecessary casts.
* vm/vm_kern.c (kmem_submap): remove unnecessary castMarin Ramesa2013-12-151-1/+1
| | | | | | The return value from vm_map_min() is already of vm_offset_t type. * vm/vm_kern.c (kmem_submap) (addr): Remove unnecessary cast.
* Declare void argument listsMarin Ramesa2013-12-153-7/+7
|
* Cleanup of the memcpy(), memmove(), memcmp() and memset() callsMarin Ramesa2013-12-111-1/+1
| | | | | | | | | | | | | | | | | | | | Addresses were cast to (void *). Pointers uncasted. * device/ds_routines.c (ds_read_done) (memset) (start_sent): Cast to (void *) instead to (char *). Argument is an address. (ds_read_done) (memset) (end_data): Likewise. * i386/i386/pcb.c (thread_getstatus) (memcpy) (pm): Don't cast. Argument is a pointer. (thread_getstatus) (memcpy) (iopb): Likewise. * i386/i386at/immc.c (immc_cnputc) (memmove): Cast first argument to (void *). Argument is an address. (immc_cnputc) (memmove): Cast second argument to (void *). Argument is an address. (immc_cnputc) (memset): Cast first argument to (void *). Argument is an address. * i386/i386at/model_dep.c (i386at_init) (memcpy) (phystokv): Cast to (void *) instead to (char *). Argument is an address. * i386/intel/pmap.c (pmap_init) (memset) (addr): Likewise. * ipc/mach_debug.c (mach_port_space_info) (memset) (table_addr + size_used): Likewise. (mach_port_space_info) (memset) (tree_addr + size_used): Likewise. * kern/host.c (host_processor_sets) (memcpy) (newaddr): Likewise. (host_processor_sets) (memcpy) (addr): Likewise. * kern/xpr.c (xprbootstrap) (memset) (addr): Likewise. * vm/vm_debug.c (mach_vm_object_pages) (memset) (addr + size_used): Likewise.
* vm/vm_map.c: use boolean instead of an intMarin Ramesa2013-12-091-2/+2
| | | | * vm/vm_map.c (vm_map_pmap_enter_print, vm_map_pmap_enter_enable): Use boolean instead of an int.
* vm/vm_object.c: remove unused variableMarin Ramesa2013-12-091-2/+0
| | | | * vm/vm_object.c (vm_object_terminate_remove_all): Remove unused variable.
* vm/vm_pageout.c: remove forward declarationsMarin Ramesa2013-12-092-3/+4
| | | | | * vm/vm_pageout.c (vm_pageout_continue, vm_pageout_scan_continue): Remove forward declarations. * vm/vm_pageout.h (vm_pageout_continue, vm_pageout_scan_continue): Add prototypes.
* Cleanup of the prototypesMarin Ramesa2013-12-092-24/+0
| | | | | | | | | | | | * device/cirbuf.h (nqdb): Remove prototype without definition. * device/conf.h (dev_set_indirect): Likewise. * kern/boot_script.h (boot_script_read_file): Likewise. * kern/eventcount.h (evc_notify_abort): Remove duplicate prototype. * kern/thread.h (thread_set_own_priority): Likewise. * kern/thread_swap.h (thread_swapout): Remove prototype without definition. * kern/timer.h (softclock): Remove duplicate prototype. * vm/pmap.h (pmap_resident_count, pmap_access, pmap_phys_address, pmap_phys_to_frame): Remove prototypes without function definition. * vm/vm_page.h (vm_set_page_size): Likewise.
* vm/vm_page.h: remove unused variablesMarin Ramesa2013-12-091-5/+0
| | | | * vm/vm_page.h (first_phys_addr, last_phys_addr): Remove unused variables.
* vm/vm_user.c: remove forward declarationMarin Ramesa2013-12-051-2/+0
| | | | * vm/vm_user.c (vm_map_machine_attribute): Remove forward declaration.
* vm/vm_resident.c: correct commentMarin Ramesa2013-12-051-1/+1
| | | | | | This is vm_resident.c, not vm_page.c. * vm/vm_resident.c: Correct comment.
* vm/vm_map.c: remove forward declarationsMarin Ramesa2013-12-052-5/+4
| | | | | * vm/vm_map.c (_vm_map_clip_start, _vm_map_copy_clip_start, _vm_map_clip_end, _vm_map_copy_clip_end): Remove forward declarations. * vm/vm_map.h (_vm_map_clip_end): Correct prototype.
* vm/vm_kern.c: remove forward declarationsMarin Ramesa2013-12-052-3/+14
| | | | | * vm/vm_kern.c (kmem_alloc_pages, kmem_remap_pages): Remove forward declarations. * vm/vm_kern.h (kmem_alloc_pages, kmem_remap_pages): Add prototypes.
* vm/vm_fault.c: remove forward declarationMarin Ramesa2013-12-052-2/+6
| | | | | * vm/vm_fault.c (vm_fault_wire_fast): Remove forward declaration. * vm/vm_fault.h (vm_fault_wire_fast): Add prototype.
* kern/startup.c: remove forward declarationsMarin Ramesa2013-12-052-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Makefrag.am: Include kern/bootstrap.h. Include vm/vm_init.h. Include device/device_init.h. * device/device_init.h: New file. Add copyright. [_DEVICE_DEVICE_INIT_H_]: Add ifndef. (device_service_create): Add prototype. * i386/i386/mp_desc.h (start_other_cpus): Add prototype. * kern/bootstrap.h: New file. Add copyright. [_KERN_BOOTSTRAP_H_]: Add ifndef. (bootstrap_create): Add prototype. * kern/sched_prim.h (idle_thread, sched_thread): Add prototypes. * kern/startup.c: Include kern/bootstrap.h. Include kern/startup.h. Include vm/vm_init.h. Include vm/vm_pageout.h. Include device/device_init.h. (vm_mem_init, vm_mem_bootstrap, init_timeout, machine_init, idle_thread, vm_pageout, reaper_thread, swapin_thread, sched_thread, bootstrap_create, device_service_create, cpu_launch_first_thread, start_kernel_threads, start_other_cpus, action_thread): Remove forward declarations. [NCPUS > 1] Include machine/mp_desc.h and kern/machine.h. * kern/startup.h: Include kern/thread.h. (cpu_launch_first_thread, start_kernel_threads): Add prototypes. * vm/vm_init.h: New file. Add copyright. [_VM_VM_INIT_H_]: Add ifndef. (vm_mem_init, vm_mem_bootstrap): Add prototypes. * vm/vm_pageout.h (vm_pageout): Add prototype.
* vm: move forward declarations into a header fileMarin Ramesa2013-11-242-16/+17
| | | | | * vm/vm_map.c (vm_map_delete, vm_map_copyout_page_list, vm_map_copy_page_discard, vm_map_lookup_entry): Remove forward declarations. * vm/vm_map.h (vm_map_delete, vm_map_copyout_page_list, vm_map_copy_page_discard, vm_map_lookup_entry): Add prototypes.
* vm: move forward declarations into a header fileMarin Ramesa2013-11-242-10/+10
| | | | | * vm/vm_object.c (memory_object_release, vm_object_deactivate_pages, vm_object_copy_delayed): Remove forward declarations. * vm/vm_object.h (memory_object_release, vm_object_deactivate_pages, vm_object_copy_delayed): Add prototypes.
* Remove leftover register qualifiersMarin Ramesa2013-11-242-4/+4
| | | | | | | | | | | | | | | * ddb/db_break.c: Remove register qualifiers. * i386/i386/pcb.c: Likewise. * i386/i386at/com.c: Likewise. * i386/i386at/lpr.c: Likewise. * i386/intel/pmap.c: Likewise. * kern/machine.c: Likewise. * kern/queue.h: Likewise. * kern/sched_prim.c: Likewise. * kern/sched_prim.h: Likewise. * kern/timer.c: Likewise. * vm/vm_fault.c: Likewise. * vm/vm_resident.h: Likewise.
* Add copyrightMarin Ramesa2013-11-191-0/+18
| | | | | | * ddb/db_write_cmd.h: Add copyright. * ipc/ipc_print.h: Likewise. * vm/vm_print.h: Likewise.
* i386/i386/vm_tuning.h: remove fileMarin Ramesa2013-11-151-1/+0
| | | | | | * i386/Makefrag.am: Remove i386/i386/vm_tuning.h. * i386/i386/vm_tuning.h: Remove file. * vm/vm_pageout.c: Don't include i386/i386/vm_tuning.h.