Re: [BUG] hugetlb MAP_PRIVATE mapping vs /dev/zero

From: David Gibson
Date: Thu Jul 01 2004 - 23:18:02 EST


On Fri, Jul 02, 2004 at 01:49:37PM +1000, David Gibson wrote:
> On Thu, Jul 01, 2004 at 07:44:22PM -0700, William Lee Irwin wrote:
> > On Thu, Jul 01, 2004 at 08:29:18PM +0400, Oleg Nesterov wrote:
> > >> We can fix hugetlbfs_file_mmap() or read_zero_pagealigned()
> > >> or both.
> >
> > On Fri, Jul 02, 2004 at 11:20:12AM +1000, David Gibson wrote:
> > > Err... surely we need to fix both, yes?
> >
> > No. /dev/zero is innocent. hugetlb is demanding VM_SHARED semantics
> > without actually setting VM_SHARED. /dev/zero tripping over its
> > nonstandard pagetable structure is not something to be dealt with
> > in /dev/zero itself.
>
> Duh, sorry, misread the sense of the VM_SHARED test in the zeromap
> code.

On second thoughts, though, I think logically it should be fixed in
both places. For now forcing VM_SHARED in the hugetlbfs code is
sufficient, but if we ever allow (real) MAP_PRIVATE hugepage mappings
(by implementing hugepage COW, for example), then the zeromap code
will need fixing.

Conceptually it's not so much the fact that the hugepage memory is
shared which is tripping up zeromap as the fact that it isn't mapped
in the normal way.

Of course, one could argue that the whole zeromap idea is just too
damn clever for its own good...

--
David Gibson | For every complex problem there is a
david AT gibson.dropbear.id.au | solution which is simple, neat and
| wrong.
http://www.ozlabs.org/people/dgibson
-
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/