Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1348547

[PATCH 09/27] staging: lustre: set task state before scheduling in lnet_sock_accept

From James Simmons <jsimmons@infradead.org>
Newsgroups linux.kernel
Subject [PATCH 09/27] staging: lustre: set task state before scheduling in lnet_sock_accept
Date 2016-03-02 23:10 +0100
Message-ID <r8n82-5Ux-93@gated-at.bofh.it> (permalink)
References <r8n7Z-5Ux-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: John L. Hammond <john.hammond@intel.com>

In the original code change when libcfs_sock_accept() was made
into lnet_sock_accept() a call to set_current_state(TASK_INTERRUPTIBLE)
got dropped which was restored. For upstream this is an
optimization of calling init_waitqueue_entry() only if
accept() return -EAGAIN. Also we can remove setting the
task to TASK_RUNNING that is not needed.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6407
Reviewed-on: http://review.whamcloud.com/14265
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Amir Shehata <amir.shehata@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
---
 drivers/staging/lustre/lnet/lnet/lib-socket.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c
index 5d77049..269a6d8 100644
--- a/drivers/staging/lustre/lnet/lnet/lib-socket.c
+++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c
@@ -531,8 +531,6 @@ lnet_sock_accept(struct socket **newsockp, struct socket *sock)
 	struct socket *newsock;
 	int rc;
 
-	init_waitqueue_entry(&wait, current);
-
 	/*
 	 * XXX this should add a ref to sock->ops->owner, if
 	 * TCP could be a module
@@ -548,11 +546,11 @@ lnet_sock_accept(struct socket **newsockp, struct socket *sock)
 	rc = sock->ops->accept(sock, newsock, O_NONBLOCK);
 	if (rc == -EAGAIN) {
 		/* Nothing ready, so wait for activity */
-		set_current_state(TASK_INTERRUPTIBLE);
+		init_waitqueue_entry(&wait, current);
 		add_wait_queue(sk_sleep(sock->sk), &wait);
+		set_current_state(TASK_INTERRUPTIBLE);
 		schedule();
 		remove_wait_queue(sk_sleep(sock->sk), &wait);
-		set_current_state(TASK_RUNNING);
 		rc = sock->ops->accept(sock, newsock, O_NONBLOCK);
 	}
 
-- 
1.7.1

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/27] Third batch of LNet fixes James Simmons <jsimmons@infradead.org> - 2016-03-02 23:10 +0100
  [PATCH 09/27] staging: lustre: set task state before scheduling in lnet_sock_accept James Simmons <jsimmons@infradead.org> - 2016-03-02 23:10 +0100
  [PATCH 05/27] staging: lustre: remove annoying message in parse_nidrange James Simmons <jsimmons@infradead.org> - 2016-03-02 23:10 +0100
  Re: [PATCH 00/27] Third batch of LNet fixes Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-03 00:30 +0100
    RE: [lustre-devel] [PATCH 00/27] Third batch of LNet fixes "Simmons, James A." <simmonsja@ornl.gov> - 2016-03-03 01:00 +0100

csiph-web