Commit c0bd1f65 authored by Jens Axboe's avatar Jens Axboe

[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: default avatarJens Axboe <axboe@suse.de>
parent 9aefe431
...@@ -187,7 +187,9 @@ static ssize_t move_to_pipe(struct inode *inode, struct page **pages, ...@@ -187,7 +187,9 @@ static ssize_t move_to_pipe(struct inode *inode, struct page **pages,
} }
if (do_wakeup) { 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, kill_fasync(PIPE_FASYNC_READERS(*inode), SIGIO,
POLL_IN); POLL_IN);
do_wakeup = 0; do_wakeup = 0;
...@@ -201,7 +203,9 @@ static ssize_t move_to_pipe(struct inode *inode, struct page **pages, ...@@ -201,7 +203,9 @@ static ssize_t move_to_pipe(struct inode *inode, struct page **pages,
mutex_unlock(PIPE_MUTEX(*inode)); mutex_unlock(PIPE_MUTEX(*inode));
if (do_wakeup) { 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); 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, ...@@ -600,7 +604,9 @@ static ssize_t move_from_pipe(struct inode *inode, struct file *out,
} }
if (do_wakeup) { 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); kill_fasync(PIPE_FASYNC_WRITERS(*inode),SIGIO,POLL_OUT);
do_wakeup = 0; do_wakeup = 0;
} }
...@@ -611,7 +617,9 @@ static ssize_t move_from_pipe(struct inode *inode, struct file *out, ...@@ -611,7 +617,9 @@ static ssize_t move_from_pipe(struct inode *inode, struct file *out,
mutex_unlock(PIPE_MUTEX(*inode)); mutex_unlock(PIPE_MUTEX(*inode));
if (do_wakeup) { 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); kill_fasync(PIPE_FASYNC_WRITERS(*inode), SIGIO, POLL_OUT);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment