From 8695583ee9eb69072212ec00779392af14c649d4 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 24 Mar 2016 17:15:23 +0000 Subject: [PATCH] ib_srpt: Reduce CPU load caused by stopping a large number of sessions Avoid that stopping a large number of SRPT sessions causes a high context switch frequency and hence a high CPU load. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6840 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/src/ib_srpt.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 6cbf2c548..f4f0f698a 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -2187,8 +2187,12 @@ static int srpt_compl_thread(void *arg) ch->sess_name, ch->qp->qp_num); scst_unregister_session(ch->sess, false, srpt_unreg_sess); - while (!kthread_should_stop()) - schedule_timeout(DIV_ROUND_UP(HZ, 10)); + set_current_state(TASK_INTERRUPTIBLE); + while (!kthread_should_stop()) { + schedule(); + set_current_state(TASK_INTERRUPTIBLE); + } + __set_current_state(TASK_RUNNING); return 0; }