[lkml]   [2002]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Linux-2.5.17

On Tue, 21 May 2002, David S. Miller wrote:
> Unfortunately, today mmdrop() (which is where destroy_context is
> invoked) happens after exit_mmap().
> Maybe some kind of "switch_from_dead_context()" type of thing?

Yes, I was thinking of an extra step like that.

The problem is just finding a _good_ context to switch to. We can do this
two different ways:

- actually doing a real context switch, but with a magic
"schedule_tail()" that ends up being the rest of do_exit(). This is
_really_ hard to get right, and implies that everything after the
context switch has to be non-blocking (since we'd block in the "wrong"
process context at that point.

- my preferred solution: speculatively find _some_ process (preferably
one that we are likely to schedule next), and use that process's
"active_mm" to do a "switch_mm()" into (and set that to "current->mm")

This is kind of like the lazy TLB thing, except going the other way.

The speculative thing has the problem of finding a good process, but I
would suggest something along the lines of:

- take the first process in the run-queue on the current CPU.
- if there is no process on th erun-queue, take our parent

The "parent" fallback is nice because (a) we're guaranteed to have a
parent and it is easily found and (b) we're going to wake our parent up
soon enough in "notify_parent()", so if the current runqueue is empty, the
parent is one of the likelier processes to end up there..

But no, I've not looked into the details. We've never stolen a mm from
anybody else before (lazy TLB _gives_ a mm to the next process, it doesn't
take it from anybody), so it might have nasty locking issues or something.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:26    [W:0.183 / U:0.052 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site