nexthop: only iterate over l3 nexthops for aging - #478
Conversation
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThe ageing callback in the nexthop control module is refactored: it is renamed from Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
aharivel
left a comment
There was a problem hiding this comment.
This is a clean optimization - good to merge as-is.
The do_ageing() callback was using nexthop_iter() which iterates over the entire nexthop memory pool. This includes all nexthop types, even though aging only applies to L3 nexthops. The callback had to check the type and return early for non-L3 entries. Instead, iterate directly over hash_by_addr which only contains L3 nexthops with an associated address. This avoids wasting cycles on nexthops that will never need aging. Signed-off-by: Robin Jarry <rjarry@redhat.com> Reviewed-by: Anthony Harivel <aharivel@redhat.com>
bf93298 to
a7b47cb
Compare
The do_ageing() callback was using nexthop_iter() which iterates over the entire nexthop memory pool. This includes all nexthop types, even though aging only applies to L3 nexthops. The callback had to check the type and return early for non-L3 entries.
Instead, iterate directly over hash_by_addr which only contains L3 nexthops with an associated address. This avoids wasting cycles on nexthops that will never need aging.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.