From: Davidlohr Bueso Date: Fri, 13 Feb 2015 22:39:08 +0000 (-0800) Subject: epoll: optimize setting task running after blocking X-Git-Tag: v4.0-rc1~90^2~40 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=4d5755b147665912c938504033d958f1115b68ff;p=linux.git epoll: optimize setting task running after blocking After waking up a task waiting for an event, we explicitly mark it as TASK_RUNNING (which is necessary as we do the checks for wakeups as TASK_INTERRUPTIBLE). Once running and dealing with actually delivering the events, we're obviously not planning on calling schedule, thus we can relax the implied barrier and simply update the state with __set_current_state(). Signed-off-by: Davidlohr Bueso Cc: Alexander Viro Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/eventpoll.c b/fs/eventpoll.c index d77f94491352..1e009cad8d5c 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -1639,9 +1639,9 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events, spin_lock_irqsave(&ep->lock, flags); } - __remove_wait_queue(&ep->wq, &wait); - set_current_state(TASK_RUNNING); + __remove_wait_queue(&ep->wq, &wait); + __set_current_state(TASK_RUNNING); } check_events: /* Is it worth to try to dig for events ? */