aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <axboe@suse.de>2006-04-10 03:03:32 -0400
committerJens Axboe <axboe@suse.de>2006-04-10 03:03:32 -0400
commitc0bd1f650bd06a43435808d44f1e9520ea806206 (patch)
treee2f4480a1bc08d9044f66c44174273abea7e0c58
parent9aefe431f5a000884db7ae74ac208de814fe5913 (diff)
[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>
-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,
187 } 187 }
188 188
189 if (do_wakeup) { 189 if (do_wakeup) {
190 wake_up_interruptible_sync(PIPE_WAIT(*inode)); 190 smp_mb();
191 if (waitqueue_active(PIPE_WAIT(*inode)))
192 wake_up_interruptible_sync(PIPE_WAIT(*inode));
191 kill_fasync(PIPE_FASYNC_READERS(*inode), SIGIO, 193 kill_fasync(PIPE_FASYNC_READERS(*inode), SIGIO,
192 POLL_IN); 194 POLL_IN);
193 do_wakeup = 0; 195 do_wakeup = 0;
@@ -201,7 +203,9 @@ static ssize_t move_to_pipe(struct inode *inode, struct page **pages,
201 mutex_unlock(PIPE_MUTEX(*inode)); 203 mutex_unlock(PIPE_MUTEX(*inode));
202 204
203 if (do_wakeup) { 205 if (do_wakeup) {
204 wake_up_interruptible(PIPE_WAIT(*inode)); 206 smp_mb();
207 if (waitqueue_active(PIPE_WAIT(*inode)))
208 wake_up_interruptible(PIPE_WAIT(*inode));
205 kill_fasync(PIPE_FASYNC_READERS(*inode), SIGIO, POLL_IN); 209 kill_fasync(PIPE_FASYNC_READERS(*inode), SIGIO, POLL_IN);
206 } 210 }
207 211
@@ -600,7 +604,9 @@ static ssize_t move_from_pipe(struct inode *inode, struct file *out,
600 } 604 }
601 605
602 if (do_wakeup) { 606 if (do_wakeup) {
603 wake_up_interruptible_sync(PIPE_WAIT(*inode)); 607 smp_mb();
608 if (waitqueue_active(PIPE_WAIT(*inode)))
609 wake_up_interruptible_sync(PIPE_WAIT(*inode));
604 kill_fasync(PIPE_FASYNC_WRITERS(*inode),SIGIO,POLL_OUT); 610 kill_fasync(PIPE_FASYNC_WRITERS(*inode),SIGIO,POLL_OUT);
605 do_wakeup = 0; 611 do_wakeup = 0;
606 } 612 }
@@ -611,7 +617,9 @@ static ssize_t move_from_pipe(struct inode *inode, struct file *out,
611 mutex_unlock(PIPE_MUTEX(*inode)); 617 mutex_unlock(PIPE_MUTEX(*inode));
612 618
613 if (do_wakeup) { 619 if (do_wakeup) {
614 wake_up_interruptible(PIPE_WAIT(*inode)); 620 smp_mb();
621 if (waitqueue_active(PIPE_WAIT(*inode)))
622 wake_up_interruptible(PIPE_WAIT(*inode));
615 kill_fasync(PIPE_FASYNC_WRITERS(*inode), SIGIO, POLL_OUT); 623 kill_fasync(PIPE_FASYNC_WRITERS(*inode), SIGIO, POLL_OUT);
616 } 624 }
617 625