summaryrefslogtreecommitdiff
path: root/include/linux/timerqueue.h
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2019-08-27 22:31:02 +0300
committerThomas Gleixner <tglx@linutronix.de>2019-08-28 12:50:43 +0300
commit60bda037f1dd8151e0c9ee5b09f0c091a0f643cd (patch)
treeac8ed446c0ae7fcdf72285d5ca99531a3f96560b /include/linux/timerqueue.h
parent244d49e30653658d4e7e9b2b8427777cbbc5affe (diff)
downloadlinux-60bda037f1dd8151e0c9ee5b09f0c091a0f643cd.tar.xz
posix-cpu-timers: Utilize timerqueue for storage
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. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1908272129220.1939@nanos.tec.linutronix.de
Diffstat (limited to 'include/linux/timerqueue.h')
-rw-r--r--include/linux/timerqueue.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/timerqueue.h b/include/linux/timerqueue.h
index aff122f1062a..93884086f392 100644
--- a/include/linux/timerqueue.h
+++ b/include/linux/timerqueue.h
@@ -43,6 +43,16 @@ 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->rb_root = RB_ROOT_CACHED;