Re: [PATCH 1/2] posix-timers: move global timer id management tosignal_struct v4

From: Eric Dumazet
Date: Mon Sep 19 2011 - 18:23:39 EST


Le lundi 19 septembre 2011 Ã 14:48 -0700, Andi Kleen a Ãcrit :
> From: Andi Kleen <ak@xxxxxxxxxxxxxxx>
>
> Move the global posix timer ids IDR to signal_struct. This removes
> a minor global scalability bottleneck and also allows to finally limit
> the number of process timers in a sane way (see next patch)
>
> I put it into signal_struct following the other posix timer per process
> structures.
>
> v2: Now with locking again (thanks Eric)
> v3: Fix the locking too (Eric Dumazet)
> v4: Use a mutex. Get rid of retry loop.
> idr_pre_get() is still there to avoid major surgery in lib/idr.c.
> Random gleixnerfication
> Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
> ---

> + mutex_lock(&sig->idr_lock);
> + error = -EAGAIN;
> + if (idr_pre_get(&sig->posix_timers_id, GFP_KERNEL))
> + error = idr_get_new(&sig->posix_timers_id, new_timer,
> + &new_timer_id);
> + mutex_unlock(&sig->idr_lock);
> if (error) {

On 64bit arches :

IDR_FREE_MAX=12 && sizeof(struct idr_layer)=544

This means idr_pre_get() consumes 6528 bytes of spare space per process,
even if only one posix timer is used.

I guess we should allow idr to call slab directly in this case (only a
mutex held, it's safe to sleep in slab), and not have this per idr
reserve/free_list : This was done because of some idr callers using a
spinlock.

I dont believe its major idr surgery :)



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/