Skip to content

Commit

Permalink
[PATCH] splice: only call wake_up_interruptible() when we really have to
Browse files Browse the repository at this point in the history
__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>
  • Loading branch information
Jens Axboe committed Apr 10, 2006
1 parent 9aefe43 commit c0bd1f6
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions fs/splice.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}

Expand Down Expand Up @@ -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;
}
Expand All @@ -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);
}

Expand Down

0 comments on commit c0bd1f6

Please sign in to comment.