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

From: Rusty Russell
Date: Wed Sep 03 2003 - 21:47:42 EST


In message <Pine.LNX.4.44.0309031201170.31853-100000@xxxxxxxxxxxxx> you write:
> Private mappings that haven't been broken by COW (and a read-only mapping
> never will be) will see updates as they happen on the file that backs it.
> That's the fundamental difference between "mmap(MAP_PRIVATE)" and
> "read()".

Right, so it would be consistent for someone doing a FUTEX_WAIT on an
"intact" (not broken by COW) private mapping to see a FUTEX_WAKE done
on that file.

However, Jamie's futex code will see !VM_SHARED on the mapping, and
compare futexes by mm + uaddr (rather than inode + file offset), so
this is NOT the case. Using VM_MAYSHARE instead would make the
MAP_SHARED readonly case work as above, though.

The way futexes are used now, they're both "don't care". If you have
a private mapping or read-only mapping, you'll never get woken by
others with the same file mapped writable shared, but WTF were you
waiting for a futex if the mapping is private anyway: the lock
acquisition won't work (and sleeping forever is easier to debug than
two tasks getting the lock).

Oh no, I think I'm starting to understand the VM a little.

Ick.

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/