lkml.org 
[lkml]   [2005]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] PF_DEAD: cleanup usage


On Sat, 26 Nov 2005, Oleg Nesterov wrote:
> >
> > So putting it back into task->state is not wrong per se, but it kind of
> > misses the point of why it was somewhere else in the first place (or
> > rather, why it was there in the _second_ place, since it was in
> > task->state in the first place and got moved out of there).
>
> schedule:
>
> if (unlikely(prev->flags & PF_DEAD))
> prev->state = EXIT_DEAD;
>
> Which means: "If PF_DEAD is set, ignore ->state value. It should be TASK_RUNNING,
> but we have to change it, otherwise the task won't be deactivated. We are using
> EXIT_DEAD (which should live only in ->exit_state) because other TASK_XXX values
> won't work".
>
> So in my opinion PF_DEAD has already slipped into the ->state partly.

You mis-understand.

PF_DEAD has _always_ been about the task state, in a very serious way. It
didn't "slip into" it. It always was very much about it.

The problem is that we touch "task->state" in a _lot_ of places: for
example, when we take a page fault, we have to clear it, because we can't
just run with some random task state (see top of __handle_mm_fault).

PF_DEAD was a "safe haven". It's somewhere that we _don't_ modify the word
in many places, so it doesn't get lost, and we can do sanity checking (ie
we can have things like "BUG_ON(tsk->flags & PF_DEAD)" to make sure that
the task really is valid in a few places.

Now, arguably the task struct handling is solid enough that maybe we don't
need this any more. But this is what it was all about: it was hidden away
in a non-obvious place exactly _because_ we wanted it hidden away
somewhere where the normal ops wouldn't ever touch it.

Linus
-
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/

\
 
 \ /
  Last update: 2009-11-18 23:46    [W:0.041 / U:0.504 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site