Re: [PATCH 3/3] [RFC] ashmem: Convert ashmem to use volatile ranges

From: John Stultz
Date: Tue Apr 24 2012 - 15:44:04 EST


On 04/24/2012 12:21 PM, Peter Zijlstra wrote:
On Tue, 2012-04-24 at 10:49 -0700, John Stultz wrote:
First pass attempt at getting ashmem to utilize the volatile range
code.
One would think the purpose of the previous patches was to entirely do
away with the ashmem interface.. this patch is a temporary band-aid to
assist in testing without having to modify userspace?

So in a way, yes. I'm trying to iteratively chip away at the staging drivers, providing a smooth transition path. This patch is just to show (or determine, depending on if the GET_PIN_STATUS is critical) that the fadvise volatile functionality is sufficient to replace the ashmem unpinning feature.

Part of the trouble with pushing the Android drivers upstream is that each driver doesn't just solve one issue, but usually handles a number of problems. Thus discussion about alternative solutions gets muddled as no one alternative is sufficient.

For the ashmem driver, one big use case is a way to provide fds to anonymous memory that can be shared between processes. This is the same as an unlinked tmpfs file, but allows them to not have tmpfs mounts, which could potentially be cluttered with poorly written or malicious applications. There is also the feature of being able to unpin memory ranges of that fd, which I thought was interesting for wider use.

The fadivse volatile work provides that unpinning feature, but doesn't do anything to try to provide atomically unlinked tmpfs fds. To solve that problem, we'll have to revisit if the simplified ashmem interface makes sense, or if there should be something like a permissions based userspace solution with a deamon that does the create/unlink and hands the fds out. But hopefully that discussion will be more clear, as it will be only about one feature.

thanks
-john

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