Re: fd_offset is not page aligned

Matti Aarnio (matti.aarnio@sonera.fi)
Mon, 25 Oct 1999 16:36:37 +0300


On Mon, Oct 25, 1999 at 02:48:43PM +0200, Jamie Lokier wrote:
> Andrea Arcangeli wrote:
> > >it would be entirely reasonable that a non-aligned mapping would pull
> > >stuff into the aligned page cache, copy it to non-aligned shared pages
> >
> > You don't want to copy at all. 2.3.x enforce coherency ...
>
> In case I'm not clear: I'm talking about read-only, MAP_DENYWRITE
> mappings. There's no coherency issue for these.

Yes, and Linus has asked me to support MAP_PRIVATE
512 byte aligned offsets at my Large File {Support|Summit} code.
( e.g. max supported offset at 32-bit systems is now
+- 512*2G = +- 1TB )

( My initial thinking was to use PAGE_SIZE shift, e.g. 4k*4G for
ia32 -- yielding 0..16 TB as offset range, but using signed
offsets at cache has its uses for i-node specific metadata )

There exists a problem somewhere deep in generic
block_read_full_page() code. From my diff:
( fs/buffer.c )

// FIXME: To support Linus' desire for 512 byte aligned mmap(MAP_PRIVATE)
// FIXME: Windows binaries, this function will need to support page-in from
// FIXME: non-page-aligned offsets within the file...

int block_read_full_page(struct file * file, struct page * page)
.....

If you can help (e.g. have time, and interest - or vice versa ;) ),
my "compiles but haven't dared to boot" for 2.3.23 is available at

ftp://mea.tmt.tele.fi/linux/LFS/

For that matter, adding a more strict:
MAP_PRIVATE|MAP_DENYWRITE
test is trivial ( mm/mmap.c: do_mmap() )


- if (off & ~PAGE_MASK)
+ if ((flags & MAP_TYPE) != MAP_PRIVATE) {
+ if ((long)off & ~PAGE_MASK) /* Page Aligned ? */
return -EINVAL;
+#if PGOFF_SHIFT == 9
+ } else {
+ if ((long)off & 511) /* Not 512 byte aligned; special support
+ mode for WINE in ia32/ia64 platforms */
+ return -EINVAL;
+#endif
+ }

> > ... and this simply means better performance.

/Matti Aarnio <matti.aarnio@sonera.fi>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/