From 530eca31556f7708781bcd1b1809ae286aee4c57 Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Sun, 7 Jun 2020 19:24:33 -0400 Subject: [PATCH] LU-12768 o2iblnd: wait properly for fps->increasing. 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 Change-Id: I16210fc6904d7605f4671f5edfa2f490526c3a16 Reviewed-on: https://review.whamcloud.com/39124 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Shaun Tancheff Reviewed-by: Chris Horn Reviewed-by: Oleg Drokin --- lnet/klnds/o2iblnd/o2iblnd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lnet/klnds/o2iblnd/o2iblnd.c b/lnet/klnds/o2iblnd/o2iblnd.c index 5a57dfcd..fd6f5d8 100644 --- a/lnet/klnds/o2iblnd/o2iblnd.c +++ b/lnet/klnds/o2iblnd/o2iblnd.c @@ -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); -- 1.8.3.1