Randomize the delay when waiting for VSC flag in mlx5core.

The PRM suggests random 0 - 10ms to prevent multiple waiters on the same
interval in order to avoid starvation.

Submitted by:	slavash@
MFC after:	3 days
Sponsored by:	Mellanox Technologies
This commit is contained in:
Hans Petter Selasky 2019-10-02 10:59:44 +00:00
parent eff4361d88
commit 7bf46a63ce

View File

@ -52,7 +52,7 @@ int mlx5_vsc_lock(struct mlx5_core_dev *mdev)
* The PRM suggests random 0 - 10ms to prevent multiple
* waiters on the same interval in order to avoid starvation
*/
DELAY((random() % 11) * 1000);
DELAY((random() % 9000) + 1000);
continue;
}
@ -99,7 +99,7 @@ mlx5_vsc_wait_on_flag(struct mlx5_core_dev *mdev, u32 expected)
break;
retries++;
DELAY(10);
DELAY((random() % 90) + 10);
}
return 0;