mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 19:56:18 +00:00
free_pidmap: turn it into free_pidmap(struct upid *)
The callers of free_pidmap() pass 2 members of "struct upid", we can just pass "struct upid *" instead. Shaves off 10 bytes from pid.o. Also, simplify the alloc_pid's "out_free:" error path a little bit. This way it looks more clear which subset of pid->numbers[] we are freeing. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Cc: Pavel Emelyanov <xemul@openvz.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc :Roland McGrath <roland@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
718a916338
commit
b7127aa454
1 changed files with 7 additions and 6 deletions
13
kernel/pid.c
13
kernel/pid.c
|
@ -111,10 +111,11 @@ EXPORT_SYMBOL(is_container_init);
|
||||||
|
|
||||||
static __cacheline_aligned_in_smp DEFINE_SPINLOCK(pidmap_lock);
|
static __cacheline_aligned_in_smp DEFINE_SPINLOCK(pidmap_lock);
|
||||||
|
|
||||||
static void free_pidmap(struct pid_namespace *pid_ns, int pid)
|
static void free_pidmap(struct upid *upid)
|
||||||
{
|
{
|
||||||
struct pidmap *map = pid_ns->pidmap + pid / BITS_PER_PAGE;
|
int nr = upid->nr;
|
||||||
int offset = pid & BITS_PER_PAGE_MASK;
|
struct pidmap *map = upid->ns->pidmap + nr / BITS_PER_PAGE;
|
||||||
|
int offset = nr & BITS_PER_PAGE_MASK;
|
||||||
|
|
||||||
clear_bit(offset, map->page);
|
clear_bit(offset, map->page);
|
||||||
atomic_inc(&map->nr_free);
|
atomic_inc(&map->nr_free);
|
||||||
|
@ -232,7 +233,7 @@ void free_pid(struct pid *pid)
|
||||||
spin_unlock_irqrestore(&pidmap_lock, flags);
|
spin_unlock_irqrestore(&pidmap_lock, flags);
|
||||||
|
|
||||||
for (i = 0; i <= pid->level; i++)
|
for (i = 0; i <= pid->level; i++)
|
||||||
free_pidmap(pid->numbers[i].ns, pid->numbers[i].nr);
|
free_pidmap(pid->numbers + i);
|
||||||
|
|
||||||
call_rcu(&pid->rcu, delayed_put_pid);
|
call_rcu(&pid->rcu, delayed_put_pid);
|
||||||
}
|
}
|
||||||
|
@ -278,8 +279,8 @@ out:
|
||||||
return pid;
|
return pid;
|
||||||
|
|
||||||
out_free:
|
out_free:
|
||||||
for (i++; i <= ns->level; i++)
|
while (++i <= ns->level)
|
||||||
free_pidmap(pid->numbers[i].ns, pid->numbers[i].nr);
|
free_pidmap(pid->numbers + i);
|
||||||
|
|
||||||
kmem_cache_free(ns->pid_cachep, pid);
|
kmem_cache_free(ns->pid_cachep, pid);
|
||||||
pid = NULL;
|
pid = NULL;
|
||||||
|
|
Loading…
Reference in a new issue