Re: pagetable_ops: Hugetlb character device example

From: Christoph Hellwig
Date: Thu Mar 22 2007 - 06:38:57 EST


On Wed, Mar 21, 2007 at 02:43:48PM -0500, Adam Litke wrote:
> The main reason I am advocating a set of pagetable_operations is to
> enable the development of a new hugetlb interface. During the hugetlb
> BOFS at OLS last year, we talked about a character device that would
> behave like /dev/zero. Many of the people were talking about how they
> just wanted to create MAP_PRIVATE hugetlb mappings without all the fuss
> about the hugetlbfs filesystem. /dev/zero is a familiar interface for
> getting anonymous memory so bringing that model to huge pages would make
> programming for anonymous huge pages easier.

That is a very laudable goal, but an utterly wrong way to get there.
Despite Linus' veto a while ago what we really want is support for transparent
super pages. Adding random pointer indirections where we had the direct
hugetlb calls before isn't helpful for that at all. As a start you might
want to make a clear destinction between core hugetlb code and the
filesystem interface to it without all the useless indirections. That
should get you as far as your char dev interface. But over the long
term the core VM needs to deal with multiple (and probably not just two)
page sizes. Given that the code to deal with different sized pages is
essentially the same just on different units on most architectures cries
for a better method to implement this than adding random function indirection
that point to mostly identical code.


And your driver is the best example of why we utterly don't want
a page_table operations interface. The last thing we want is random
driver taking over core VM functionality. The right way would be to a
filesystem/driver to tell (or maybe just give hints) which page size
to use for this mapping.
-
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/