OpenVZ Forum


Home » Mailing lists » Devel » [PATCH v5] posix timers: allocate timer id per process
Re: [PATCH v5] posix timers: allocate timer id per process [message #48564 is a reply to message #48563] Tue, 23 October 2012 07:52 Go to previous messageGo to previous message
Eric Dumazet is currently offline  Eric Dumazet
Messages: 36
Registered: July 2006
Member
On Tue, 2012-10-23 at 11:40 +0400, Stanislav Kinsbursky wrote:
> 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 process. 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 has 512 slots.
> Key is constructed as follows:
> key = hash_32(hash_32(current->signal) ^ posix_timer_id));
>
> Note: with this patch, id, returned to user, is not the minimal free
> amymore. It means, that id, returned to user space in loop, listed below, will
> be increasing on each iteration till INT_MAX and then dropped to zero:
>
> while(1) {
> id = timer_create(...);
> timer_delete(id);
> }
>
> Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
>
> ---

SGTM

Signed-off-by: Eric Dumazet <edumazet@google.com>

Thanks !
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [PATCH v6 00/10] IPC: checkpoint/restore in userspace enhancements
Next Topic: [PATCH] lockd: fix races in per-net NSM client handling
Goto Forum:
  


Current Time: Fri Aug 22 05:17:08 GMT 2025

Total time taken to generate the page: 0.05538 seconds