On 10/17/2024 4:07 AM, Easwar Hariharan wrote:
We have several places where timeouts are open-coded as N (seconds) * HZ,
but best practice is to use msecs_to_jiffies(). Convert the timeouts to
make them HZ invariant.
Signed-off-by: Easwar Hariharan <eahariha@xxxxxxxxxxxxxxxxxxx>
---
drivers/hv/hv_balloon.c | 9 +++++----
drivers/hv/hv_kvp.c | 4 ++--
drivers/hv/hv_snapshot.c | 6 ++++--
drivers/hv/vmbus_drv.c | 2 +-
4 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
index c38dcdfcb914d..3017d41f12681 100644
--- a/drivers/hv/hv_balloon.c
<.>
if (wait_for_completion_timeout(
- &vmbus_connection.ready_for_resume_event, 10 * HZ) == 0)
+ &vmbus_connection.ready_for_resume_event, msecs_to_jiffies(10 * 1000)) == 0)
pr_err("Some vmbus device is missing after suspending?\n");
/* Reset the event for the next suspend. */
Looks good to me. There can be different ways of passing arg to
msecs_to_jiffies though-
for 10 seconds
* 10000
* 10 * 1000
* 10 * MSEC_PER_SEC
I don't have any strong opinion on this, and you can probably choose
whichever feels better.
Even the current implementation with x * HZ works fine, with different
HZ values. But, yes, I agree that using msecs_to_jiffies is better.
Regards,
Naman