diff options
| author | Ingo Molnar <mingo@kernel.org> | 2019-11-19 11:00:45 +0300 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2019-11-19 11:00:45 +0300 |
| commit | 9f4813b531a0b8cc502fcfb142937fe4e9104d77 (patch) | |
| tree | 97ff9123582e2a9d0fd21b73cbd4abe728cafa93 /include/linux/timerqueue.h | |
| parent | 44e09568cf2d874cb2a8e2ac35acf71a9ae3402b (diff) | |
| parent | af42d3466bdc8f39806b26f593604fdc54140bcb (diff) | |
| download | linux-9f4813b531a0b8cc502fcfb142937fe4e9104d77.tar.xz | |
Merge tag 'v5.4-rc8' into WIP.x86/mm, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/timerqueue.h')
| -rw-r--r-- | include/linux/timerqueue.h | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/include/linux/timerqueue.h b/include/linux/timerqueue.h index 78b8cc73f12f..93884086f392 100644 --- a/include/linux/timerqueue.h +++ b/include/linux/timerqueue.h @@ -12,8 +12,7 @@ struct timerqueue_node { }; struct timerqueue_head { - struct rb_root head; - struct timerqueue_node *next; + struct rb_root_cached rb_root; }; @@ -29,13 +28,14 @@ extern struct timerqueue_node *timerqueue_iterate_next( * * @head: head of timerqueue * - * Returns a pointer to the timer node that has the - * earliest expiration time. + * Returns a pointer to the timer node that has the earliest expiration time. */ static inline struct timerqueue_node *timerqueue_getnext(struct timerqueue_head *head) { - return head->next; + struct rb_node *leftmost = rb_first_cached(&head->rb_root); + + return rb_entry(leftmost, struct timerqueue_node, node); } static inline void timerqueue_init(struct timerqueue_node *node) @@ -43,9 +43,18 @@ static inline void timerqueue_init(struct timerqueue_node *node) RB_CLEAR_NODE(&node->node); } +static inline bool timerqueue_node_queued(struct timerqueue_node *node) +{ + return !RB_EMPTY_NODE(&node->node); +} + +static inline bool timerqueue_node_expires(struct timerqueue_node *node) +{ + return node->expires; +} + static inline void timerqueue_init_head(struct timerqueue_head *head) { - head->head = RB_ROOT; - head->next = NULL; + head->rb_root = RB_ROOT_CACHED; } #endif /* _LINUX_TIMERQUEUE_H */ |
