[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <168712140755.404.17638032400776880983.tip-bot2@tip-bot2>
Date: Sun, 18 Jun 2023 20:50:07 -0000
From: "tip-bot2 for Thomas Gleixner" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Thomas Gleixner <tglx@...utronix.de>,
Frederic Weisbecker <frederic@...nel.org>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: timers/core] posix-timers: Cleanup comments about timer ID tracking
The following commit has been merged into the timers/core branch of tip:
Commit-ID: 8d44b958a1a088195524c884f0437660e0522380
Gitweb: https://git.kernel.org/tip/8d44b958a1a088195524c884f0437660e0522380
Author: Thomas Gleixner <tglx@...utronix.de>
AuthorDate: Tue, 25 Apr 2023 20:49:01 +02:00
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Sun, 18 Jun 2023 22:41:48 +02:00
posix-timers: Cleanup comments about timer ID tracking
Describe the hash table properly and remove the IDR leftover comments.
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Reviewed-by: Frederic Weisbecker <frederic@...nel.org>
Link: https://lore.kernel.org/r/20230425183313.038444551@linutronix.de
---
kernel/time/posix-timers.c | 28 ++++++++--------------------
1 file changed, 8 insertions(+), 20 deletions(-)
diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
index 0c61f29..79909a2 100644
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -35,20 +35,17 @@
#include "timekeeping.h"
#include "posix-timers.h"
-/*
- * Management arrays for POSIX timers. Timers are now kept in static hash table
- * with 512 entries.
- * Timer ids are allocated by local routine, which selects proper hash head by
- * key, constructed from current->signal address and per signal struct counter.
- * This keeps timer ids unique per process, but now they can intersect between
- * processes.
- */
+static struct kmem_cache *posix_timers_cache;
/*
- * Lets keep our timers in a slab cache :-)
+ * Timers are managed in a hash table for lockless lookup. The hash key is
+ * constructed from current::signal and the timer ID and the timer is
+ * matched against current::signal and the timer ID when walking the hash
+ * bucket list.
+ *
+ * This allows checkpoint/restore to reconstruct the exact timer IDs for
+ * a process.
*/
-static struct kmem_cache *posix_timers_cache;
-
static DEFINE_HASHTABLE(posix_timers_hashtable, 9);
static DEFINE_SPINLOCK(hash_lock);
@@ -66,15 +63,6 @@ static const struct k_clock clock_realtime, clock_monotonic;
#endif
/*
- * The timer ID is turned into a timer address by idr_find().
- * Verifying a valid ID consists of:
- *
- * a) checking that idr_find() returns other than -1.
- * b) checking that the timer id matches the one in the timer itself.
- * c) that the timer owner is in the callers thread group.
- */
-
-/*
* CLOCKs: The POSIX standard calls for a couple of clocks and allows us
* to implement others. This structure defines the various
* clocks.
Powered by blists - more mailing lists