diff options
author | alc <alc@FreeBSD.org> | 2003-09-08 02:45:03 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2003-09-08 02:45:03 +0000 |
commit | a81d9ad0b98e80387ddd4e42ca6d4d3a2e30c1ec (patch) | |
tree | b2790809d73f520fb71ebb6aa2acc4efb7933854 /sys/sparc64 | |
parent | ce0ede96f1c4135dba204423dccf8e16f7dc1dbd (diff) | |
download | FreeBSD-src-a81d9ad0b98e80387ddd4e42ca6d4d3a2e30c1ec.zip FreeBSD-src-a81d9ad0b98e80387ddd4e42ca6d4d3a2e30c1ec.tar.gz |
Introduce a new pmap function, pmap_extract_and_hold(). This function
atomically extracts and holds the physical page that is associated with the
given pmap and virtual address. Such a function is needed to make the
memory mapping optimizations used by, for example, pipes and raw disk I/O
MP-safe.
Reviewed by: tegge
Diffstat (limited to 'sys/sparc64')
-rw-r--r-- | sys/sparc64/sparc64/pmap.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/sparc64/sparc64/pmap.c b/sys/sparc64/sparc64/pmap.c index f4a391b..f532152 100644 --- a/sys/sparc64/sparc64/pmap.c +++ b/sys/sparc64/sparc64/pmap.c @@ -621,6 +621,28 @@ pmap_extract(pmap_t pm, vm_offset_t va) } /* + * Atomically extract and hold the physical page with the given + * pmap and virtual address pair. + */ +vm_page_t +pmap_extract_and_hold(pmap_t pmap, vm_offset_t va) +{ + vm_paddr_t pa; + vm_page_t m; + + m = NULL; + mtx_lock(&Giant); + if ((pa = pmap_extract(pmap, va)) != 0) { + m = PHYS_TO_VM_PAGE(pa); + vm_page_lock_queues(); + vm_page_hold(m); + vm_page_unlock_queues(); + } + mtx_unlock(&Giant); + return (m); +} + +/* * Extract the physical page address associated with the given kernel virtual * address. */ |