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>
spin_unlock(&fps->fps_lock);
CDEBUG(D_NET, "Another thread is allocating new "
"FMR pool, waiting for her to complete\n");
spin_unlock(&fps->fps_lock);
CDEBUG(D_NET, "Another thread is allocating new "
"FMR pool, waiting for her to complete\n");
+ wait_var_event(fps, !fps->fps_increasing);
rc = kiblnd_create_fmr_pool(fps, &fpo);
spin_lock(&fps->fps_lock);
fps->fps_increasing = 0;
rc = kiblnd_create_fmr_pool(fps, &fpo);
spin_lock(&fps->fps_lock);
fps->fps_increasing = 0;
if (rc == 0) {
fps->fps_version++;
list_add_tail(&fpo->fpo_list, &fps->fps_pool_list);
if (rc == 0) {
fps->fps_version++;
list_add_tail(&fpo->fpo_list, &fps->fps_pool_list);