Commit 2ee50b65 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] faster wakeups in the pipe code

Use prepare_to-wait/finish_wait to avoid bouncing the waitqueue
spinlock between the waker and the wakee all the time.
parent 3480cbc1
......@@ -34,13 +34,12 @@
/* Drop the inode semaphore and wait for a pipe event, atomically */
void pipe_wait(struct inode * inode)
{
DECLARE_WAITQUEUE(wait, current);
current->state = TASK_INTERRUPTIBLE;
add_wait_queue(PIPE_WAIT(*inode), &wait);
DEFINE_WAIT(wait);
prepare_to_wait(PIPE_WAIT(*inode), &wait, TASK_INTERRUPTIBLE);
up(PIPE_SEM(*inode));
schedule();
remove_wait_queue(PIPE_WAIT(*inode), &wait);
current->state = TASK_RUNNING;
finish_wait(PIPE_WAIT(*inode), &wait);
down(PIPE_SEM(*inode));
}
......
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