* [patch/21411] tweak realloc/MREMAP comment
@ 2017-05-02 20:30 DJ Delorie
2017-05-03 3:33 ` Siddhesh Poyarekar
0 siblings, 1 reply; 3+ messages in thread
From: DJ Delorie @ 2017-05-02 20:30 UTC (permalink / raw)
To: libc-alpha
I think this subtle change makes the comment match the existing source
better. However, we never actually munmap pages when shrinking mmap'd
chunks... in theory, we could just use munmap() even if mremap is
unavailable, yes? (and even if we make that change, we would then add
a *new* comment documenting that behavior, the old comment still
wouldn't be corect).
IIRC, we don't try to map-copy-unmap such shrinking chunks because
they tend to be very large, and would incur a large cost penalty for a
rare case, where the kernel could just swap out the unneeded pages.
Patch ok? (it's basically just s/reallocated/grown/)
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 068ffc1..aa45626 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -514,9 +514,9 @@ void* __libc_calloc(size_t, size_t);
REALLOC_ZERO_BYTES_FREES is set, realloc with a size argument of
zero (re)allocates a minimum-sized chunk.
- Large chunks that were internally obtained via mmap will always
- be reallocated using malloc-copy-free sequences unless
- the system supports MREMAP (currently only linux).
+ Large chunks that were internally obtained via mmap will always be
+ grown using malloc-copy-free sequences unless the system supports
+ MREMAP (currently only linux).
The old unix realloc convention of allowing the last-free'd chunk
to be used as an argument to realloc is not supported.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch/21411] tweak realloc/MREMAP comment
2017-05-02 20:30 [patch/21411] tweak realloc/MREMAP comment DJ Delorie
@ 2017-05-03 3:33 ` Siddhesh Poyarekar
2017-05-03 20:29 ` DJ Delorie
0 siblings, 1 reply; 3+ messages in thread
From: Siddhesh Poyarekar @ 2017-05-03 3:33 UTC (permalink / raw)
To: libc-alpha
On Wednesday 03 May 2017 02:00 AM, DJ Delorie wrote:
> I think this subtle change makes the comment match the existing source
> better. However, we never actually munmap pages when shrinking mmap'd
> chunks... in theory, we could just use munmap() even if mremap is
> unavailable, yes? (and even if we make that change, we would then add
> a *new* comment documenting that behavior, the old comment still
> wouldn't be corect).
>
> IIRC, we don't try to map-copy-unmap such shrinking chunks because
> they tend to be very large, and would incur a large cost penalty for a
> rare case, where the kernel could just swap out the unneeded pages.
>
> Patch ok? (it's basically just s/reallocated/grown/)
Yes.
Siddhesh
>
> diff --git a/malloc/malloc.c b/malloc/malloc.c
> index 068ffc1..aa45626 100644
> --- a/malloc/malloc.c
> +++ b/malloc/malloc.c
> @@ -514,9 +514,9 @@ void* __libc_calloc(size_t, size_t);
> REALLOC_ZERO_BYTES_FREES is set, realloc with a size argument of
> zero (re)allocates a minimum-sized chunk.
>
> - Large chunks that were internally obtained via mmap will always
> - be reallocated using malloc-copy-free sequences unless
> - the system supports MREMAP (currently only linux).
> + Large chunks that were internally obtained via mmap will always be
> + grown using malloc-copy-free sequences unless the system supports
> + MREMAP (currently only linux).
>
> The old unix realloc convention of allowing the last-free'd chunk
> to be used as an argument to realloc is not supported.
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch/21411] tweak realloc/MREMAP comment
2017-05-03 3:33 ` Siddhesh Poyarekar
@ 2017-05-03 20:29 ` DJ Delorie
0 siblings, 0 replies; 3+ messages in thread
From: DJ Delorie @ 2017-05-03 20:29 UTC (permalink / raw)
To: Siddhesh Poyarekar; +Cc: libc-alpha
Siddhesh Poyarekar <siddhesh@gotplt.org> writes:
>> Patch ok? (it's basically just s/reallocated/grown/)
>
> Yes.
Thanks, pushed.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-05-03 20:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-02 20:30 [patch/21411] tweak realloc/MREMAP comment DJ Delorie
2017-05-03 3:33 ` Siddhesh Poyarekar
2017-05-03 20:29 ` DJ Delorie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).