diff options
author | alc <alc@FreeBSD.org> | 2003-03-29 06:14:14 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2003-03-29 06:14:14 +0000 |
commit | 6f59be774d7b820d9fc3ec62a551dbb881c00d04 (patch) | |
tree | 0d26d230982c48b5d6defcaaa8f062e187a0a894 /sys/kern | |
parent | 7d7faf316e9c5a228a2d89b980b0120ca7b564f9 (diff) | |
download | FreeBSD-src-6f59be774d7b820d9fc3ec62a551dbb881c00d04.zip FreeBSD-src-6f59be774d7b820d9fc3ec62a551dbb881c00d04.tar.gz |
Pass the vm_page's address to sf_buf_alloc(); map the vm_page as part
of sf_buf_alloc() instead of expecting sf_buf_alloc()'s caller to map it.
The ultimate reason for this change is to enable two optimizations:
(1) that there never be more than one sf_buf mapping a vm_page at a time
and (2) 64-bit architectures can transparently use their 1-1 virtual
to physical mapping (e.g., "K0SEG") avoiding the overhead of pmap_qenter()
and pmap_qremove().
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/uipc_cow.c | 4 | ||||
-rw-r--r-- | sys/kern/uipc_syscalls.c | 15 |
2 files changed, 7 insertions, 12 deletions
diff --git a/sys/kern/uipc_cow.c b/sys/kern/uipc_cow.c index 26b3f4c..6dc23d1 100644 --- a/sys/kern/uipc_cow.c +++ b/sys/kern/uipc_cow.c @@ -144,9 +144,7 @@ socow_setup(struct mbuf *m0, struct uio *uio) /* * Allocate an sf buf */ - sf = sf_buf_alloc(); - sf->m = pp; - pmap_qenter(sf->kva, &pp, 1); + sf = sf_buf_alloc(pp); /* * attach to mbuf diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 6773452..bbd2992 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1637,7 +1637,7 @@ sf_buf_init(void *arg) * Get an sf_buf from the freelist. Will block if none are available. */ struct sf_buf * -sf_buf_alloc() +sf_buf_alloc(struct vm_page *m) { struct sf_buf *sf; int error; @@ -1655,8 +1655,11 @@ sf_buf_alloc() if (error) break; } - if (sf != NULL) + if (sf != NULL) { SLIST_REMOVE_HEAD(&sf_freelist.sf_head, free_list); + sf->m = m; + pmap_qenter(sf->kva, &sf->m, 1); + } mtx_unlock(&sf_freelist.sf_lock); return (sf); } @@ -1930,7 +1933,7 @@ retry_lookup: * Get a sendfile buf. We usually wait as long as necessary, * but this wait can be interrupted. */ - if ((sf = sf_buf_alloc()) == NULL) { + if ((sf = sf_buf_alloc(pg)) == NULL) { vm_page_lock_queues(); vm_page_unwire(pg, 0); if (pg->wire_count == 0 && pg->object == NULL) @@ -1942,12 +1945,6 @@ retry_lookup: } /* - * Allocate a kernel virtual page and insert the physical page - * into it. - */ - sf->m = pg; - pmap_qenter(sf->kva, &pg, 1); - /* * Get an mbuf header and set it up as having external storage. */ MGETHDR(m, M_TRYWAIT, MT_DATA); |