Skip to contentSkip to conversation

mbind and alignment

DISCUSSION Samuel Thibault 4 participants 5 messages Apr 2, 2007 – Apr 4, 2007 Memory management

lore
Share & tools
lore
#0 lore raw

Hi,

mbind(start, len, ...) currently requires that "start" be page-aligned, but not "len" (which automatically gets page-rounded up). This is a bit odd:

- the userland type of start is void*, which people would expect to be a pointer to some variable.
- start needing to be page-aligned but len not needing to is not very consistent.
- none of this is documented in the manual page dated 2006-02-07

So one of those should probably be done to free people from headaches:

- document "start" requirement in the manual page
- require len to be aligned too, and document the requirements in the manual page
- drop the "start" requirement and just round down the page + adjust size automatically.

Samuel

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#1 lore raw
Quoted 12 lines · Samuel Thibault

Hi,

mbind(start, len, ...) currently requires that "start" be page-aligned, but not "len" (which automatically gets page-rounded up). This is a bit odd:

- the userland type of start is void*, which people would expect to be a pointer to some variable.
- start needing to be page-aligned but len not needing to is not very consistent.
- none of this is documented in the manual page dated 2006-02-07

Quoted 8 lines

So one of those should probably be done to free people from headaches:

- document "start" requirement in the manual page
- require len to be aligned too, and document the requirements in the manual page
- drop the "start" requirement and just round down the page + adjust size automatically.

Want to help with man page maintenance? Grab the latest tarball at ftp://ftp.win.tue.nl/pub/linux-local/manpages/,
read the HOWTOHELP file and grep the source files for 'FIXME'.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw
In reply to Samuel Thibault
Quoted 8 lines

So one of those should probably be done to free people from headaches:

- document "start" requirement in the manual page
- require len to be aligned too, and document the requirements in the manual page
- drop the "start" requirement and just round down the page + adjust size automatically.

This annoyed me in the past too. The kernel should have done that alignment by itself. But changing it now would be a bad idea because it would produce programs that run on newer kernels but break on olders. Documenting it is the only sane option left.

-Andi

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw

Hi,

Andi Kleen, le Wed 04 Apr 2007 13:52:04 +0200, a ecrit :

Quoted 8 lines
Quoted 7 lines

So one of those should probably be done to free people from headaches:

- document "start" requirement in the manual page
- require len to be aligned too, and document the requirements in the manual page
- drop the "start" requirement and just round down the page + adjust size automatically.

Quoted 4 lines

This annoyed me in the past too. The kernel should have done that alignment by itself. But changing it now would be a bad idea because it would produce programs that run on newer kernels but break on olders. Documenting it is the only sane option left.

Ok. I already sent a patch to the manpages maintainer.

Samuel

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#4 lore raw
In reply to Andi Kleen
Quoted 9 lines · Andi Kleen
Quoted 8 lines

So one of those should probably be done to free people from headaches:

- document "start" requirement in the manual page
- require len to be aligned too, and document the requirements in the manual page
- drop the "start" requirement and just round down the page + adjust size automatically.

Quoted 4 lines

This annoyed me in the past too. The kernel should have done that alignment by itself. But changing it now would be a bad idea because it would produce programs that run on newer kernels but break on olders. Documenting it is the only sane option left.

It is annoying, but consistent with all mm's msyscall()s: they all (I bet you'll now point me to an exception or two!) fail if start is not page aligned, but silently round up len. UNIX did it like that. Documentation is indeed the answer.

Hugh

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>