Re: [PATCH] net: af_packet: add af_packet hrtimer mode
From: Xin Zhao
Date: Fri Aug 08 2025 - 01:07:56 EST
On Wed, 2025-08-06 at 16:51 +0800, Ferenc wrote:
> I doubt we need another CONFIG option ?
>
> Also this seems to be beneficial for HZ=100 or HZ=250 configuration,
> maybe worth mentioning in the changelog.
>
> But more importantly, I think you should explain what difference this
> really makes,
> in which circumstances this timer needs to fire...
>
> If real-time is a concern, maybe using a timer to perform GC-style operation
> is a no go anyway...
Dear Eric,
I've thought about it, and I really didn't foresee any obvious drawbacks
after switching to hrtimer, so in PATCH v1, I removed that config and directly
changed it to hrtimer.
As you mentioned, this issue is indeed more pronounced on systems with HZ=250
or HZ=100. Our testing environment was also based on a system with HZ=250,
which is still quite common in embedded systems.
Regarding the benefits of using hrtimer, I already provided the test data and
testing environment in my previous reply to Ferenc, and the improvements are
quite significant.
As for when the retire timer expires, I've reviewed this logic. From my
perspective, the existing mechanism in AF_PACKET is complete. In the
prb_retire_rx_blk_timer_expired function, there is a check to see if there are
any packets in the current block. If there are packets, the status will be
reported to user space. By switching to hrtimer, I aimed to ensure that the
timeout handling in the prb_retire_rx_blk_timer_expired function can be
executed in a more timely manner.
Thanks
Xin Zhao