linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* mbind and alignment
@ 2007-04-02 20:42 Samuel Thibault
  2007-04-03 21:27 ` Chuck Ebbert
  2007-04-04 11:52 ` Andi Kleen
  0 siblings, 2 replies; 5+ messages in thread
From: Samuel Thibault @ 2007-04-02 20:42 UTC (permalink / raw)
  To: linux-kernel, linux-mm

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 majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: mbind and alignment
  2007-04-02 20:42 mbind and alignment Samuel Thibault
@ 2007-04-03 21:27 ` Chuck Ebbert
  2007-04-04 11:52 ` Andi Kleen
  1 sibling, 0 replies; 5+ messages in thread
From: Chuck Ebbert @ 2007-04-03 21:27 UTC (permalink / raw)
  To: Samuel Thibault, linux-kernel, linux-mm

Samuel Thibault wrote:
> 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.
> 

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 majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: mbind and alignment
  2007-04-02 20:42 mbind and alignment Samuel Thibault
  2007-04-03 21:27 ` Chuck Ebbert
@ 2007-04-04 11:52 ` Andi Kleen
  2007-04-04 12:26   ` Samuel Thibault
  2007-04-04 17:19   ` Hugh Dickins
  1 sibling, 2 replies; 5+ messages in thread
From: Andi Kleen @ 2007-04-04 11:52 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: linux-kernel, linux-mm

> 
> 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 majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: mbind and alignment
  2007-04-04 11:52 ` Andi Kleen
@ 2007-04-04 12:26   ` Samuel Thibault
  2007-04-04 17:19   ` Hugh Dickins
  1 sibling, 0 replies; 5+ messages in thread
From: Samuel Thibault @ 2007-04-04 12:26 UTC (permalink / raw)
  To: Andi Kleen; +Cc: linux-kernel, linux-mm

Hi,

Andi Kleen, le Wed 04 Apr 2007 13:52:04 +0200, a ecrit :
> > 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.

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

Samuel

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: mbind and alignment
  2007-04-04 11:52 ` Andi Kleen
  2007-04-04 12:26   ` Samuel Thibault
@ 2007-04-04 17:19   ` Hugh Dickins
  1 sibling, 0 replies; 5+ messages in thread
From: Hugh Dickins @ 2007-04-04 17:19 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Samuel Thibault, linux-kernel, linux-mm

On Wed, 4 Apr 2007, Andi Kleen wrote:
> > 
> > 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.

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 majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-04-04 17:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-02 20:42 mbind and alignment Samuel Thibault
2007-04-03 21:27 ` Chuck Ebbert
2007-04-04 11:52 ` Andi Kleen
2007-04-04 12:26   ` Samuel Thibault
2007-04-04 17:19   ` Hugh Dickins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox