Re: 2.6.9-rc1-mm5

From: Kirill Korotaev
Date: Tue Sep 14 2004 - 01:41:24 EST


Andrew Morton wrote:
Kirill Korotaev <dev@xxxxx> wrote:

Please replace patch next_thread-bug-fixes.patch in -mm5 tree with the last diff-next_thread I sent to you.

I was planning on replacing it with Ingo's patch.
1. next_thread-bug-fixes.patch has nothing to do with Ingo's patch.
next_thread-bug-fixes.patch is cosmetic and a bit unfull (it should better check that the process is still hashed, which I added in my patch).
So I ask you to replace it with diff-next_thread (I resend it once again), which fixes original kernel and should replace the above patch in your tree.

The comments for this patch
~~~~~~~~~~~~~~~~~~~~~~~~~~~
This patch changes obscure BUG() checks in next_thread()
with pid checks meaning exactly the same (It simply checks if the task
is still hashed). Also original check was incorrect since it required
ANY of the locks (siglock or tasklist_lock) while siglock is not required at all and tasklist_lock is ALWAYS required.

Signed-Off-By: Kirill Korotaev <dev@xxxxx>

2. The BUG() which is resolved in Ingo's patch is fixed in -mm5 tree with show-aggregate-per-process-counters-in-proc-pid-stat-2.patch
So you needn't to apply Ingo's patch.

--- linux/fs/proc/array.c.orig
+++ linux/fs/proc/array.c
@@ -356,7 +356,7 @@ static int do_task_stat(struct task_stru
stime = task->signal->stime;
}
}
- if (whole) {
+ if (whole && task->sighand) {

Is there some reason why your patch is better? If so, please do a full
resend.

My patch was a bit more self explaining as we discussed with Ingo.
But due to being already fixed, I don't think you have to bother with it.

Kirill --- ./kernel/exit.c.nt 2004-09-13 18:00:12.727181136 +0400
+++ ./kernel/exit.c 2004-09-13 18:00:51.864231400 +0400
@@ -848,10 +848,7 @@ asmlinkage long sys_exit(int error_code)
task_t fastcall *next_thread(const task_t *p)
{
#ifdef CONFIG_SMP
- if (!p->sighand)
- BUG();
- if (!spin_is_locked(&p->sighand->siglock) &&
- !rwlock_is_locked(&tasklist_lock))
+ if (!rwlock_is_locked(&tasklist_lock) || p->pids[PIDTYPE_TGID].nr == 0)
BUG();
#endif
return pid_task(p->pids[PIDTYPE_TGID].pid_list.next, PIDTYPE_TGID);