pmap_quick_remove_page (9)
Leading comments
Copyright (c) 2015 Jason A. Harmening <jah@FreeBSD.org> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the do...
NAME
pmap_quick_enter_page pmap_quick_remove_page - manage fast, single-page kernel address space mappingsSYNOPSIS
In sys/param.h In vm/vm.h In vm/pmap.h Ft vm_offset_t Fn pmap_quick_enter_page vm_page_t m Ft void Fn pmap_quick_remove_page vm_offset_t kvaDESCRIPTION
The Fn pmap_quick_enter_page function accepts a single page Fa m , and enters this page into a preallocated address in kernel virtual address (KVA) space. This function is intended for temporary mappings that will only be used for a very short period, for example a copy operation on the page contents.The Fn pmap_quick_remove_page function removes a mapping previously created by Fn pmap_quick_enter_page at Fa kva , making the KVA frame used by Fn pmap_quick_enter_page available for reuse.
On many architectures, Fn pmap_quick_enter_page uses a per-CPU pageframe. In those cases, it must disable preemption on the local CPU. The corresponding call to Fn pmap_quick_remove_page then re-enables preemption. It is therefore not safe for machine-independent code to sleep or perform locking operations while holding these mappings. Current implementations only guarantee the availability of a single page for the calling thread, so calls to Fn pmap_quick_enter_page must not be nested.
Fn pmap_quick_enter_page and Fn pmap_quick_remove_page do not sleep, and Fn pmap_quick_enter_page always returns a valid address. It is safe to use these functions under all types of locks except spin mutexes. It is also safe to use them in all thread contexts except primary interrupt context.
The page must not be swapped or otherwise reused while the mapping is active. It must be either wired or held, or it must belong to an unmanaged region such as I/O device memory.