summaryrefslogtreecommitdiff
path: root/fs/splice.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@suse.de>2006-04-10 11:03:32 +0400
committerJens Axboe <axboe@suse.de>2006-04-10 11:03:32 +0400
commitc0bd1f650bd06a43435808d44f1e9520ea806206 (patch)
treee2f4480a1bc08d9044f66c44174273abea7e0c58 /fs/splice.c
parent9aefe431f5a000884db7ae74ac208de814fe5913 (diff)
downloadlinux-c0bd1f650bd06a43435808d44f1e9520ea806206.tar.xz
[PATCH] splice: only call wake_up_interruptible() when we really have to
__wake_up_common() is pretty heavy in the kernel profiles, this brings it down to a more acceptable level. Signed-off-by: Jens Axboe <axboe@suse.de>
Diffstat (limited to 'fs/splice.c')
-rw-r--r--fs/splice.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/fs/splice.c b/fs/splice.c
index 26f5f7ecee5c..9f796b1034d1 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -187,7 +187,9 @@ static ssize_t move_to_pipe(struct inode *inode, struct page **pages,
}
if (do_wakeup) {
- wake_up_interruptible_sync(PIPE_WAIT(*inode));
+ smp_mb();
+ if (waitqueue_active(PIPE_WAIT(*inode)))
+ wake_up_interruptible_sync(PIPE_WAIT(*inode));
kill_fasync(PIPE_FASYNC_READERS(*inode), SIGIO,
POLL_IN);
do_wakeup = 0;
@@ -201,7 +203,9 @@ static ssize_t move_to_pipe(struct inode *inode, struct page **pages,
mutex_unlock(PIPE_MUTEX(*inode));
if (do_wakeup) {
- wake_up_interruptible(PIPE_WAIT(*inode));
+ smp_mb();
+ if (waitqueue_active(PIPE_WAIT(*inode)))
+ wake_up_interruptible(PIPE_WAIT(*inode));
kill_fasync(PIPE_FASYNC_READERS(*inode), SIGIO, POLL_IN);
}
@@ -600,7 +604,9 @@ static ssize_t move_from_pipe(struct inode *inode, struct file *out,
}
if (do_wakeup) {
- wake_up_interruptible_sync(PIPE_WAIT(*inode));
+ smp_mb();
+ if (waitqueue_active(PIPE_WAIT(*inode)))
+ wake_up_interruptible_sync(PIPE_WAIT(*inode));
kill_fasync(PIPE_FASYNC_WRITERS(*inode),SIGIO,POLL_OUT);
do_wakeup = 0;
}
@@ -611,7 +617,9 @@ static ssize_t move_from_pipe(struct inode *inode, struct file *out,
mutex_unlock(PIPE_MUTEX(*inode));
if (do_wakeup) {
- wake_up_interruptible(PIPE_WAIT(*inode));
+ smp_mb();
+ if (waitqueue_active(PIPE_WAIT(*inode)))
+ wake_up_interruptible(PIPE_WAIT(*inode));
kill_fasync(PIPE_FASYNC_WRITERS(*inode), SIGIO, POLL_OUT);
}