[RFC] kernel/pid.c pid allocation wierdness

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Pavel Emelianov
Date: Wednesday, March 14, 2007 - 12:30 am

Hi.

I'm looking at how alloc_pid() works and can't understand
one (simple/stupid) thing.

It first kmem_cache_alloc()-s a strct pid, then calls
alloc_pidmap() and at the end it taks a global pidmap_lock()
to add new pid to hash.

The question is - why does alloc_pidmap() use at least
two atomic ops and potentially loop to find a zero bit
in pidmap? Why not call alloc_pidmap() under pidmap_lock
and find zero pid in pidmap w/o any loops and atomics?

The same is for free_pid(). Do I miss something?

Thank,
Pavel
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC] kernel/pid.c pid allocation wierdness, Pavel Emelianov, (Wed Mar 14, 12:30 am)
Re: [RFC] kernel/pid.c pid allocation wierdness, Eric W. Biederman, (Wed Mar 14, 7:12 am)
Re: [RFC] kernel/pid.c pid allocation wierdness, William Lee Irwin III, (Wed Mar 14, 7:43 am)
Re: [RFC] kernel/pid.c pid allocation wierdness, William Lee Irwin III, (Wed Mar 14, 8:03 am)
Re: [RFC] kernel/pid.c pid allocation wierdness, Oleg Nesterov, (Wed Mar 14, 8:33 am)
Re: [RFC] kernel/pid.c pid allocation wierdness, Eric W. Biederman, (Wed Mar 14, 9:54 am)
Re: [RFC] kernel/pid.c pid allocation wierdness, William Lee Irwin III, (Thu Mar 15, 1:26 pm)
Re: [RFC] kernel/pid.c pid allocation wierdness, Pavel Emelianov, (Fri Mar 16, 3:57 am)
Re: [RFC] kernel/pid.c pid allocation wierdness, Eric Dumazet, (Fri Mar 16, 4:37 am)
Re: [RFC] kernel/pid.c pid allocation wierdness, Dmitry Adamushko, (Fri Mar 16, 4:40 am)
Re: [RFC] kernel/pid.c pid allocation wierdness, Pavel Emelianov, (Fri Mar 16, 4:58 am)
Re: [RFC] kernel/pid.c pid allocation wierdness, Eric W. Biederman, (Fri Mar 16, 6:04 am)
Re: [RFC] kernel/pid.c pid allocation wierdness, William Lee Irwin III, (Fri Mar 16, 12:46 pm)
Re: [RFC] kernel/pid.c pid allocation wierdness, Eric W. Biederman, (Fri Mar 16, 2:18 pm)