summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_syscalls.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2007-05-03 14:42:42 +0000
committerrwatson <rwatson@FreeBSD.org>2007-05-03 14:42:42 +0000
commit20848234d96d64f1050c92166ebffc88afcc2fae (patch)
tree1bcae9ed15171271aa6fc97f1e539335630da9e9 /sys/kern/uipc_syscalls.c
parent9bb125a79a492945d63a1509b80173d7740b1411 (diff)
downloadFreeBSD-src-20848234d96d64f1050c92166ebffc88afcc2fae.zip
FreeBSD-src-20848234d96d64f1050c92166ebffc88afcc2fae.tar.gz
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.
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 53de5bc..463ae89 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]
OpenPOWER on IntegriCloud