OpenVZ Forum - RDF feed
type: channel
items: [PATCH v3] posix timers: allocate timer id per process
items: Re: [PATCH v3] posix timers: allocate timer id per process

[PATCH v3] posix timers: allocate timer id per process
type: item
description: v3: 1) hash calculation simlified to improve perfomance. v2: 1) Hash table become RCU-friendly. Hash table search now done under RCU lock protection. I've tested scalability on KVM with 4 CPU. The testing environment was build of 10 processes, each had 512 posix timers running (SIGSEV_NONE) and was calling timer_gettime() in loop. With all this stuff being running, I was measuring time of calling of syscall timer_gettime() 10000 times. Without this patch: ~7ms With this patch : ~7ms This patch is required CRIU project (www.criu.org). To migrate processes with posix timers we have to make sure, that we can restore posix timer with proper id. Currently, this is not true, because timer ids are allocated globally. So, this is precursor patch and it's purpose is make posix timer id to be allocated per process. Patch replaces global idr with global hash table for posix timers and makes timer ids unique not globally, but per task. Next free timer id is type of integer and stored on signal struct (posix_timer_id). If free timer id reaches negative value on timer creation, it will be dropped to zero and -EAGAIN will be returned to user. Hash table is size of page (4KB). Key is constructed as follows: key = hash_ptr(current->signal) ^ hash_32(posix_timer_id); Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> --- include/linux/posix-timers.h | 1 include/linux/sched.h | 4 +- kernel/posix-timers.c | 111 ++++++++++++++++++++++++++++-------------- 3 files changed, 77 insertions(+), 39 deletions(-) diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h index 042058f..60bac69 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 */ diff --git a/include/linux/sched.h…
creator: Stanislav Kinsbursky
date: 2012-10-18T07:49:05-00:00

Re: [PATCH v3] posix timers: allocate timer id per process
type: item
description: On Thu, 2012-10-18 at 11:49 +0400, Stanislav Kinsbursky wrote: > + > +static struct k_itimer *__posix_timers_find(struct hlist_head *head, struct signal_struct *sig, timer_t id) This line is too long Please use scripts/checkpatch.pl Other than that, your patch seems fine to me Thanks
creator: Eric Dumazet
date: 2012-10-18T08:04:30-00:00