Whamcloud - gitweb
LU-12768 o2iblnd: wait properly for fps->increasing. 24/39124/2
authorMr NeilBrown <neilb@suse.de>
Sun, 7 Jun 2020 23:24:33 +0000 (19:24 -0400)
committerOleg Drokin <green@whamcloud.com>
Sat, 4 Jul 2020 03:05:19 +0000 (03:05 +0000)
If we need to allocate a new fmr_pool and another thread is currently
allocating one, we call schedule() and then try again.  This can spin,
consuming a CPU and wasting power.

Instead, use wait_var_event() and wake_up_var() to
wait for fps_increasing to be cleared.

Test-Parameters: trivial testlist=sanity-lnet
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I16210fc6904d7605f4671f5edfa2f490526c3a16
Reviewed-on: https://review.whamcloud.com/39124
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.c

index 5a57dfc..fd6f5d8 100644 (file)
@@ -1929,7 +1929,7 @@ again:
                spin_unlock(&fps->fps_lock);
                CDEBUG(D_NET, "Another thread is allocating new "
                       "FMR pool, waiting for her to complete\n");
-               schedule();
+               wait_var_event(fps, !fps->fps_increasing);
                goto again;
 
        }
@@ -1947,6 +1947,7 @@ again:
        rc = kiblnd_create_fmr_pool(fps, &fpo);
        spin_lock(&fps->fps_lock);
        fps->fps_increasing = 0;
+       wake_up_var(fps);
        if (rc == 0) {
                fps->fps_version++;
                list_add_tail(&fpo->fpo_list, &fps->fps_pool_list);