Re: [PATCH] Alternate futex non-page-pinning and COW fix

From: Rusty Russell
Date: Sun Sep 07 2003 - 21:09:32 EST


In message <20030907132010.GB19977@xxxxxxxxxxxxxxxxxx> you write:
> I don't see a problem, as long as it is documented. Anybody grokking
> the old futex code would expect futexes to move with mappings.

BTW, I don't know of anyone *doing* this, but IMHO it's not worth a
single line of kernel code, since if you don't adjust your futex
addresses when you mremap, the try_down_futex will segv after the poll
or whatever. As a programmer, I would *expect* to have to reset the
futexes (along with every other pointer into the map) when mremap
happens: after all, I told the kernel to watch the old address. If it
still works, great, but I'd not expect it.

> > Yes. Invalidate is nice because it catches a programmer mistake. But
> > why not solve the problem by just holding an mm reference, too?
>
> That would work. An mm isn't that huge once everything's been
> unmapped by exit. Alternatively, mm-private futexes can be woken when
> the mm is destroyed.
>
> I just implemented the latter, but come to think of it a reference to
> a dead mm is light enough not to bother with a list of "futexes
> attached to mm to destroy on exit".
>
> So I'll throw that away and provide a patch which just takes a reference.
> (Also, takes inode references).

Agreed. You can get a page per 2 fds trivially anyway with pipes, so
staying within that bound is fairly safe.

Cheers!
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/