mbox series

[0/2] rdma: Converge on using secs_to_jiffies()

Message ID 20250219-rdma-secs-to-jiffies-v1-0-b506746561a9@linux.microsoft.com (mailing list archive)
Headers show
Series rdma: Converge on using secs_to_jiffies() | expand

Message

Easwar Hariharan Feb. 19, 2025, 9:36 p.m. UTC
This series converts users of msecs_to_jiffies() that either use the
multiply pattern of either of:
- msecs_to_jiffies(N*1000) or
- msecs_to_jiffies(N*MSEC_PER_SEC)

where N is a constant or an expression, to avoid the multiplication.

The conversion is made with Coccinelle with the secs_to_jiffies() script
in scripts/coccinelle/misc. Attention is paid to what the best change
can be rather than restricting to what the tool provides.

This series is based on next-20250219

Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
---
Easwar Hariharan (2):
      RDMA/mlx4: convert timeouts to secs_to_jiffies()
      RDMA/mlx5: convert timeouts to secs_to_jiffies()

 drivers/infiniband/hw/mlx4/alias_GUID.c | 2 +-
 drivers/infiniband/hw/mlx5/mr.c         | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
---
base-commit: 8936cec5cb6e27649b86fabf383d7ce4113bba49
change-id: 20250219-rdma-secs-to-jiffies-21fb900be3fe

Best regards,

Comments

Leon Romanovsky Feb. 20, 2025, 7:07 a.m. UTC | #1
On Wed, Feb 19, 2025 at 09:36:38PM +0000, Easwar Hariharan wrote:
> This series converts users of msecs_to_jiffies() that either use the
> multiply pattern of either of:
> - msecs_to_jiffies(N*1000) or
> - msecs_to_jiffies(N*MSEC_PER_SEC)
> 
> where N is a constant or an expression, to avoid the multiplication.

Can you please provide justification for that? What is wrong with current code?

Thanks
Easwar Hariharan Feb. 20, 2025, 4:17 p.m. UTC | #2
On 2/19/2025 11:07 PM, Leon Romanovsky wrote:
> On Wed, Feb 19, 2025 at 09:36:38PM +0000, Easwar Hariharan wrote:
>> This series converts users of msecs_to_jiffies() that either use the
>> multiply pattern of either of:
>> - msecs_to_jiffies(N*1000) or
>> - msecs_to_jiffies(N*MSEC_PER_SEC)
>>
>> where N is a constant or an expression, to avoid the multiplication.
> 
> Can you please provide justification for that? What is wrong with current code?
> 

There is nothing specifically wrong with the current code, it just does an unnecessary
multiplication for what it does, as the cover letter mentions. IMHO, it's also more readable
to just see secs_to_jiffies(30) and understand that it's a 30 second timeout.

Thanks,
Easwar (he/him)