Using a linear O(N) search for timer insertion affects execution time and D-cache footprint badly with a larger number of timers. Switch the storage to a timerqueue which is already used for hrtimers and alarmtimers. It does not affect the size of struct k_itimer as it.alarm is still larger. The extra list head for the expiry list will go away later once the expiry is moved into task work context.
Showing the changes to include/linux/timerqueue.h (1 of 3 files). Show all
Unified · Split
| @@ -43,6 +43,16 @@ static inline void timerqueue_init(struct timerqueue_node *node) · 42 unmodified lines | |||
| 43 | RB_CLEAR_NODE(&node->node); | 43 | RB_CLEAR_NODE(&node->node); |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | static inline bool timerqueue_node_queued(struct timerqueue_node *node) | ||
| 47 | { | ||
| 48 | return !RB_EMPTY_NODE(&node->node); | ||
| 49 | } | ||
| 50 | |||
| 51 | static inline bool timerqueue_node_expires(struct timerqueue_node *node) | ||
| 52 | { | ||
| 53 | return node->expires; | ||
| 54 | } | ||
| 55 | |||
| 46 | static inline void timerqueue_init_head(struct timerqueue_head *head) | 56 | static inline void timerqueue_init_head(struct timerqueue_head *head) |
| 47 | { | 57 | { |
| 48 | head->rb_root = RB_ROOT_CACHED; | 58 | head->rb_root = RB_ROOT_CACHED; |