diff options
| author | Ingo Molnar <mingo@elte.hu> | 2002-09-19 00:25:45 -0700 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2002-09-19 00:25:45 -0700 |
| commit | 64cf8edb62434d9efe3ae4ebdb4d73716ad27d9a (patch) | |
| tree | fc4400a9a94fd7f810d2bacec967aa23c3c2b482 /kernel/user.c | |
| parent | a3a132ea1d82242539aa89143fb70cf864f6a7d5 (diff) | |
[PATCH] generic-pidhash-2.5.36-J2, BK-curr
This is the latest version of the generic pidhash patch. The biggest
change is the removal of separately allocated pid structures: they are
now part of the task structure and the first task that uses a PID will
provide the pid structure. Task refcounting is used to avoid the
freeing of the task structure before every member of a process group or
session has exited.
This approach has a number of advantages besides the performance gains.
Besides simplifying the whole hashing code significantly, attach_pid()
is now fundamentally atomic and can be called during create_process()
without worrying about task-list side-effects. It does not have to
re-search the pidhash to find out about raced PID-adding either, and
attach_pid() cannot fail due to OOM. detach_pid() can do a simple
put_task_struct() instead of the kmem_cache_free().
The only minimal downside is the potential pending task structures after
session leaders or group leaders have exited - but the number of orphan
sessions and process groups is usually very low - and even if it's
higher, this can be regarded as a slow execution of the final
deallocation of the session leader, not some additional burden.
Diffstat (limited to 'kernel/user.c')
| -rw-r--r-- | kernel/user.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/kernel/user.c b/kernel/user.c index 752cda29c965..0704b2aad9c5 100644 --- a/kernel/user.c +++ b/kernel/user.c @@ -64,6 +64,11 @@ static inline struct user_struct *uid_hash_find(uid_t uid, struct list_head *has return NULL; } +struct user_struct *find_user(uid_t uid) +{ + return uid_hash_find(uid, uidhashentry(uid)); +} + void free_uid(struct user_struct *up) { if (up && atomic_dec_and_lock(&up->__count, &uidhash_lock)) { |
