Re: [patch] user-vm-unlock-2.5.31-A2

From: Jamie Lokier (lk@tantalophile.demon.co.uk)
Date: Thu Aug 15 2002 - 05:31:48 EST


Ingo Molnar wrote:
> > I wonder if it makes more sense for the release word to be a futex --
> > then various ways of actually waiting for the stack are available.
>
> the window for locking is really small (and will always be small), so it's
> cheaper for the fastpath to implement this as a spinlock, with the
> stack-user being the lock holder.

I'm thinking that any _clean_ threading library (pthreads or not)
should do these two things:

   - intercept all the system calls that might call mmput(); that is,
     exit() and execve()), just so it can move the thread-specific data
     (including the stack) onto the "potentially free list".

   - free the stack memory as soon as possible after a thread has died,
     _without_ depending on garbage collection. What if all the other
     threads are compute-bound? There's a lump of unnecessary stack
     taking up memory for an indefinite time.

It seems that you're using a futex anyway -- so why not eliminate that
pesky system call _and_ make sure pthread_join() work if some library
you're linked to exits without calling pthread_exit()..

-- Jamie
-
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 : Thu Aug 15 2002 - 22:00:39 EST