Re: doublefault debugging (was Re: Linux v2.5.62 --- spontaneous reboots)

From: Linus Torvalds (torvalds@transmeta.com)
Date: Thu Feb 20 2003 - 17:32:02 EST


On Thu, 20 Feb 2003, Ingo Molnar wrote:
>
> well, we can do the wait_task_inactive() in both cases - in
> release_task(), and in __put_task_struct(). [in the release_task() path
> that will just be a nop]. This further simplifies the patch.

I think the _real_ simplification is to just have the task switch do this
in the tail:

        if (prev->state & TASK_DEAD)
                put_task_struct(prev);

suddenly we don't have any issues at all with possibly freeing stuff
before its time, since we're guaranteed to keep the process around untill
we've properly scheduled out of it.

Suggested patch (against current BK, which has the finish_task_switch()
cleanups I mentioned earlier) appended. No special cases, nu subtlety with
__put_task_struct() caches, no nothing.

                Linus

-----
===== kernel/exit.c 1.97 vs edited =====
--- 1.97/kernel/exit.c Thu Feb 20 03:10:35 2003
+++ edited/kernel/exit.c Thu Feb 20 14:28:39 2003
@@ -103,7 +103,6 @@
                 dput(proc_dentry);
         }
         release_thread(p);
- put_task_struct(p);
 }
 
 /* we are using it only for SMP init */
===== kernel/sched.c 1.160 vs edited =====
--- 1.160/kernel/sched.c Thu Feb 20 05:42:54 2003
+++ edited/kernel/sched.c Thu Feb 20 14:27:23 2003
@@ -581,6 +581,8 @@
         finish_arch_switch(rq, prev);
         if (mm)
                 mmdrop(mm);
+ if (prev->state & TASK_DEAD)
+ put_task_struct(prev);
 }
 
 /**

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Feb 23 2003 - 22:00:31 EST