Whamcloud - gitweb
LU-12678 o2iblnd: use need_resched() 25/39125/2
authorMr NeilBrown <neilb@suse.de>
Sun, 7 Jun 2020 23:24:32 +0000 (19:24 -0400)
committerOleg Drokin <green@whamcloud.com>
Sat, 4 Jul 2020 03:05:23 +0000 (03:05 +0000)
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>
lnet/klnds/o2iblnd/o2iblnd.h
lnet/klnds/o2iblnd/o2iblnd_cb.c

index ad09426..f165e07 100644 (file)
@@ -82,8 +82,6 @@
 #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
index 3b3ede1..7e9a3b1 100644 (file)
@@ -3655,7 +3655,6 @@ kiblnd_scheduler(void *arg)
        unsigned long           flags;
        struct ib_wc            wc;
        int                     did_something;
-       int                     busy_loops = 0;
        int                     rc;
 
        init_waitqueue_entry(&wait, current);
@@ -3673,11 +3672,10 @@ kiblnd_scheduler(void *arg)
        spin_lock_irqsave(&sched->ibs_lock, flags);
 
        while (!kiblnd_data.kib_shutdown) {
-               if (busy_loops++ >= IBLND_RESCHED) {
+               if (need_resched()) {
                        spin_unlock_irqrestore(&sched->ibs_lock, flags);
 
                        cond_resched();
-                       busy_loops = 0;
 
                        spin_lock_irqsave(&sched->ibs_lock, flags);
                }
@@ -3773,7 +3771,6 @@ kiblnd_scheduler(void *arg)
                spin_unlock_irqrestore(&sched->ibs_lock, flags);
 
                schedule();
-               busy_loops = 0;
 
                remove_wait_queue(&sched->ibs_waitq, &wait);
                set_current_state(TASK_RUNNING);