Rather than using a counter to decide when to drop
the lock and see if we need to reshedule we can
use need_resched(), which is a precise test instead of a guess.
Test-Parameters: trivial testlist=sanity-lnet
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I43a1d9d0963622953761f25e13bc4781c2b02be2
Reviewed-on: https://review.whamcloud.com/39125
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
#include <lnet/lib-lnet.h>
#define IBLND_PEER_HASH_SIZE 101 /* # peer_ni lists */
#include <lnet/lib-lnet.h>
#define IBLND_PEER_HASH_SIZE 101 /* # peer_ni lists */
-/* # scheduler loops before reschedule */
-#define IBLND_RESCHED 100
#define IBLND_N_SCHED 2
#define IBLND_N_SCHED_HIGH 4
#define IBLND_N_SCHED 2
#define IBLND_N_SCHED_HIGH 4
unsigned long flags;
struct ib_wc wc;
int did_something;
unsigned long flags;
struct ib_wc wc;
int did_something;
int rc;
init_waitqueue_entry(&wait, current);
int rc;
init_waitqueue_entry(&wait, current);
spin_lock_irqsave(&sched->ibs_lock, flags);
while (!kiblnd_data.kib_shutdown) {
spin_lock_irqsave(&sched->ibs_lock, flags);
while (!kiblnd_data.kib_shutdown) {
- if (busy_loops++ >= IBLND_RESCHED) {
spin_unlock_irqrestore(&sched->ibs_lock, flags);
cond_resched();
spin_unlock_irqrestore(&sched->ibs_lock, flags);
cond_resched();
spin_lock_irqsave(&sched->ibs_lock, flags);
}
spin_lock_irqsave(&sched->ibs_lock, flags);
}
spin_unlock_irqrestore(&sched->ibs_lock, flags);
schedule();
spin_unlock_irqrestore(&sched->ibs_lock, flags);
schedule();
remove_wait_queue(&sched->ibs_waitq, &wait);
set_current_state(TASK_RUNNING);
remove_wait_queue(&sched->ibs_waitq, &wait);
set_current_state(TASK_RUNNING);