public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Remove references to sbrk to grow/shrink arenas
@ 2016-10-10 17:33 Siddhesh Poyarekar
  2016-10-10 17:41 ` DJ Delorie
  0 siblings, 1 reply; 3+ messages in thread
From: Siddhesh Poyarekar @ 2016-10-10 17:33 UTC (permalink / raw)
  To: libc-alpha

The manual incorrectly references sbrk as the method used to grow and
shrink heaps and the fact that M_TRIM_THRESHOLD and M_TOP_PAD control
that behavior.  In reality, a heap may be grown or shrunk through
multiple methods depending on whether it is the main arena (in which
case sbrk is correct) or not (in which case, there are a number of
strategies including allocating an additional heap to grow an arena
and/or 'mprotect' a region to make it available for allocation).

Remove references to sbrk so that it covers the behavior more
accurately.

	* manual/memory.texi (M_TOP_PAD): Remove reference to sbrk.
	(M_TRIM_THRESHOLD): Likewise.
---
 manual/memory.texi | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/manual/memory.texi b/manual/memory.texi
index b98dcf2..8ef2bbd 100644
--- a/manual/memory.texi
+++ b/manual/memory.texi
@@ -1138,18 +1138,16 @@ overwritten.
 This parameter can also be set for the process at startup by setting the
 environment variable @code{MALLOC_MMAP_PERTURB_} to the desired value.
 @item M_TOP_PAD
-This parameter determines the amount of extra memory to obtain from the
-system when a call to @code{sbrk} is required.  It also specifies the
-number of bytes to retain when shrinking the heap by calling @code{sbrk}
-with a negative argument.  This provides the necessary hysteresis in
-heap size such that excessive amounts of system calls can be avoided.
+This parameter determines the amount of extra memory to obtain from the system
+when an arena needs to be extended.  It also specifies the number of bytes to
+retain when shrinking an arena.  This provides the necessary hysteresis in heap
+size such that excessive amounts of system calls can be avoided.
 
 This parameter can also be set for the process at startup by setting the
 environment variable @code{MALLOC_TOP_PAD_} to the desired value.
 @item M_TRIM_THRESHOLD
 This is the minimum size (in bytes) of the top-most, releasable chunk
-that will cause @code{sbrk} to be called with a negative argument in
-order to return memory to the system.
+that will trigger a system call in order to return memory to the system.
 
 This parameter can also be set for the process at startup by setting the
 environment variable @code{MALLOC_TRIM_THRESHOLD_} to the desired value.
-- 
2.7.4

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

* Re: [PATCH] Remove references to sbrk to grow/shrink arenas
  2016-10-10 17:33 [PATCH] Remove references to sbrk to grow/shrink arenas Siddhesh Poyarekar
@ 2016-10-10 17:41 ` DJ Delorie
  2016-10-26  9:48   ` Siddhesh Poyarekar
  0 siblings, 1 reply; 3+ messages in thread
From: DJ Delorie @ 2016-10-10 17:41 UTC (permalink / raw)
  To: Siddhesh Poyarekar; +Cc: libc-alpha


Siddhesh Poyarekar <siddhesh@sourceware.org> writes:
> 	* manual/memory.texi (M_TOP_PAD): Remove reference to sbrk.
> 	(M_TRIM_THRESHOLD): Likewise.

These changes look good to me from the malloc side of things.

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

* Re: [PATCH] Remove references to sbrk to grow/shrink arenas
  2016-10-10 17:41 ` DJ Delorie
@ 2016-10-26  9:48   ` Siddhesh Poyarekar
  0 siblings, 0 replies; 3+ messages in thread
From: Siddhesh Poyarekar @ 2016-10-26  9:48 UTC (permalink / raw)
  To: DJ Delorie; +Cc: libc-alpha

On Monday 10 October 2016 11:10 PM, DJ Delorie wrote:
> 
> Siddhesh Poyarekar <siddhesh@sourceware.org> writes:
>> 	* manual/memory.texi (M_TOP_PAD): Remove reference to sbrk.
>> 	(M_TRIM_THRESHOLD): Likewise.
> 
> These changes look good to me from the malloc side of things.
> 

Thanks, pushed.

Siddhesh

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

end of thread, other threads:[~2016-10-26  9:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-10 17:33 [PATCH] Remove references to sbrk to grow/shrink arenas Siddhesh Poyarekar
2016-10-10 17:41 ` DJ Delorie
2016-10-26  9:48   ` Siddhesh Poyarekar

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).