aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/uipc_syscalls.c
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2007-05-03 14:42:42 +0000
committerRobert Watson <rwatson@FreeBSD.org>2007-05-03 14:42:42 +0000
commit7abab911355ed67c91bd461873ee7c7e04a5ed49 (patch)
tree1bcae9ed15171271aa6fc97f1e539335630da9e9 /sys/kern/uipc_syscalls.c
parent61f31ed6cf30ff5b62cf1b3d7fb08c83e99c57ba (diff)
downloadsrc-7abab911355ed67c91bd461873ee7c7e04a5ed49.tar.gz
src-7abab911355ed67c91bd461873ee7c7e04a5ed49.zip
sblock() implements a sleep lock by interlocking SB_WANT and SB_LOCK flags
on each socket buffer with the socket buffer's mutex. This sleep lock is used to serialize I/O on sockets in order to prevent I/O interlacing. This change replaces the custom sleep lock with an sx(9) lock, which results in marginally better performance, better handling of contention during simultaneous socket I/O across multiple threads, and a cleaner separation between the different layers of locking in socket buffers. Specifically, the socket buffer mutex is now solely responsible for serializing simultaneous operation on the socket buffer data structure, and not for I/O serialization. While here, fix two historic bugs: (1) a bug allowing I/O to be occasionally interlaced during long I/O operations (discovere by Isilon). (2) a bug in which failed non-blocking acquisition of the socket buffer I/O serialization lock might be ignored (discovered by sam). SCTP portion of this patch submitted by rrs.
Notes
Notes: svn path=/head/; revision=169236
Diffstat (limited to 'sys/kern/uipc_syscalls.c')
-rw-r--r--sys/kern/uipc_syscalls.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index 53de5bc23c1d..463ae89984a9 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -1920,9 +1920,7 @@ kern_sendfile(struct thread *td, struct sendfile_args *uap,
}
/* Protect against multiple writers to the socket. */
- SOCKBUF_LOCK(&so->so_snd);
(void) sblock(&so->so_snd, M_WAITOK);
- SOCKBUF_UNLOCK(&so->so_snd);
/*
* Loop through the pages of the file, starting with the requested
@@ -2196,9 +2194,7 @@ retry_space:
}
done:
- SOCKBUF_LOCK(&so->so_snd);
sbunlock(&so->so_snd);
- SOCKBUF_UNLOCK(&so->so_snd);
out:
/*
* If there was no error we have to clear td->td_retval[0]