| Age | Commit message (Collapse) | Author |
|
From: Manfred Spraul <manfred@colorfullife.com>
de_thread calls list_del(¤t->tasks), but current->tasks was never
added to the task list. The structure contains stale values from the parent.
switch_exec_pid() transforms a normal thread to a thread group leader.
Thread group leaders are included in the init_task.tasks linked list,
non-leaders are not in that list. The patch adds the new thread group
leader to the linked list, otherwise de_thread corrupts the task list.
|
|
|
|
Patch from Bill Irwin. Prodding from me.
The hashtables in kernel/pid.c are 128 kbytes, which is far too large for
very small machines.
So we dynamically size them and allocate them from bootmem. From 16 buckets
on the very smallest machine up to 4096 buckets (effectively half the current
size) with one gigabyte of memory or more.
The patch also switches the hashing from a custom hash over to the more
powerful hash_long().
|
|
|
|
This removes the cmpxchg from the PID allocator and replaces it with a
spinlock. This spinlock is hit only a couple of times per bootup, so
it's not a performance issue.
|
|
This does the following things:
- removes the ->thread_group list and uses a new PIDTYPE_TGID pid class
to handle thread groups. This cleans up lots of code in signal.c and
elsewhere.
- fixes sys_execve() if a non-leader thread calls it. (2.5.38 crashed in
this case.)
- renames list_for_each_noprefetch to __list_for_each.
- cleans up delayed-leader parent notification.
- introduces link_pid() to optimize PIDTYPE_TGID installation in the
thread-group case.
I've tested the patch with a number of threaded and non-threaded
workloads, and it works just fine. Compiles & boots on UP and SMP x86.
The session/pgrp bugs reported to lkml are probably still open, they are
the next on my todo - now that we have a clean pidhash architecture they
should be easier to fix.
|
|
the attached patch (against BK-curr) fixes a bug in the new PID allocator,
which bug can cause incorrect hashing of the PID structure which causes
infinite loops in find_pid(). [and potentially other problems.]
|
|
|
|
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.
|