From 5ed67f05f66c41e39880a6d61358438a25f9fee5 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Mon, 11 Mar 2013 13:12:21 +0400 Subject: posix timers: Allocate timer id per process (v2) Currently kernel generates IDs for posix timers in a global manner -- there's a kernel-wide IDR tree from which IDs are created. This makes it impossible to recreate a timer with a desired ID (in particular this is done by the CRIU checkpoint-restore project) -- since these IDs are global it may happen, that at the time we recreate a timer, the ID we want for it is already busy by some other timer. In order to address this, replace the IDR tree with a global hash table for timers and makes timer IDs unique per signal_struct (to which timers are linked anyway). With this, two timers belonging to different processes may have equal IDs and we can recreate either of them with the ID we want. Signed-off-by: Pavel Emelyanov Cc: Peter Zijlstra Cc: Michael Kerrisk Cc: Matthew Helsley Link: http://lkml.kernel.org/r/513D9FF5.9010004@parallels.com Signed-off-by: Thomas Gleixner --- include/linux/posix-timers.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/linux/posix-timers.h') diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h index 042058fdb0af..60bac697a91b 100644 --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h @@ -55,6 +55,7 @@ struct cpu_timer_list { /* POSIX.1b interval timer structure. */ struct k_itimer { struct list_head list; /* free/ allocate list */ + struct hlist_node t_hash; spinlock_t it_lock; clockid_t it_clock; /* which timer type */ timer_t it_id; /* timer id */ -- cgit v1.2.3-59-g8ed1b