Skip to content

Commit 8d44b95

Browse files
committed
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@linutronix.de> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> Link: https://lore.kernel.org/r/20230425183313.038444551@linutronix.de
1 parent 7d99090 commit 8d44b95

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

kernel/time/posix-timers.c

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,17 @@
3535
#include "timekeeping.h"
3636
#include "posix-timers.h"
3737

38-
/*
39-
* Management arrays for POSIX timers. Timers are now kept in static hash table
40-
* with 512 entries.
41-
* Timer ids are allocated by local routine, which selects proper hash head by
42-
* key, constructed from current->signal address and per signal struct counter.
43-
* This keeps timer ids unique per process, but now they can intersect between
44-
* processes.
45-
*/
38+
static struct kmem_cache *posix_timers_cache;
4639

4740
/*
48-
* Lets keep our timers in a slab cache :-)
41+
* Timers are managed in a hash table for lockless lookup. The hash key is
42+
* constructed from current::signal and the timer ID and the timer is
43+
* matched against current::signal and the timer ID when walking the hash
44+
* bucket list.
45+
*
46+
* This allows checkpoint/restore to reconstruct the exact timer IDs for
47+
* a process.
4948
*/
50-
static struct kmem_cache *posix_timers_cache;
51-
5249
static DEFINE_HASHTABLE(posix_timers_hashtable, 9);
5350
static DEFINE_SPINLOCK(hash_lock);
5451

@@ -65,15 +62,6 @@ static const struct k_clock clock_realtime, clock_monotonic;
6562
#error "SIGEV_THREAD_ID must not share bit with other SIGEV values!"
6663
#endif
6764

68-
/*
69-
* The timer ID is turned into a timer address by idr_find().
70-
* Verifying a valid ID consists of:
71-
*
72-
* a) checking that idr_find() returns other than -1.
73-
* b) checking that the timer id matches the one in the timer itself.
74-
* c) that the timer owner is in the callers thread group.
75-
*/
76-
7765
/*
7866
* CLOCKs: The POSIX standard calls for a couple of clocks and allows us
7967
* to implement others. This structure defines the various

0 commit comments

Comments
 (0)