lkml.org 
[lkml]   [1999]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Bug in mremap
> While preparing a patch for 2.3, I happened to notice that
> mremap (if it moves the mapping changes the offset into whats mapped)!
>
> It does this with got 2.2.9 & 2.0.32.
>- new_vma->vm_offset = vma->vm_offset + (addr - vma->vm_start);

The original looks correct to me. If you remap the `complete' VMA,
(addr - vma->vm_start) will be zero and the offset will remain
unchanged. If however, you remap only the trailing part of a file
VMA, the new offset will have to be adjusted by a positive value. Am
I missing sth ?

> The fact that this hasn't shown up before amazes me. The only
> explanation I can think of this is both a linux specifc syscall
> (so doesn't get used much) and only really useful for anonymous
> pages (where the offset into the mapping doesn't matter anyway.

Yes, but note that mremap() is used quite extensively for anonymous
pages, because realloc() uses it for large reallocations (I've
verified that e.g. GNU Emacs does these quite often).

Regards,
Wolfram.
--
`Surf the sea, not double-u three...'
wmglo@dent.med.uni-muenchen.de

-
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/

\
 
 \ /
  Last update: 2005-03-22 13:51    [from the cache]
©2003-2011 Jasper Spaans