diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2022-02-26 21:28:35 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2022-02-27 17:56:05 +0300 |
commit | ece628e5a347dd319cffe4b53dbd73ebc42d0b4d (patch) | |
tree | c464a5542b7e9e1c9ac9ec3195a5c303ce6f30de /allchblk.c | |
parent | b04141e736946ad77e83f95c75625e069699d507 (diff) | |
download | bdwgc-ece628e5a347dd319cffe4b53dbd73ebc42d0b4d.tar.gz |
Allow to unmap memory block right in GC cycle where block is freed
This commit changes how GC_unmap_threshold is interpreted:
GC_unmap_threshold==N now means block is returned to OS if the block
is freed N-1 collections ago (previously was: N collections ago).
* allchblk.c [USE_MUNMAP && !MUNMAP_THRESHOLD] (MUNMAP_THRESHOLD):
Change value from 6 to 7.
* configure.ac [$enable_munmap!=no && ($MUNMAP_THRESHOLD=""
|| $MUNMAP_THRESHOLD=yes)] (MUNMAP_THRESHOLD): Likewise.
* allchblk.c [USE_MUNMAP] (GC_unmap_old): Go on with unmapping also if
GC_gc_no==hb_last_reclaimed+GC_unmap_threshold; update comment.
* configure.ac (munmap): Update help string (including change of the
default value from 6 to 7).
* configure.ac [$enable_munmap!=no] (MUNMAP_THRESHOLD): Likewise.
* doc/README.environment (GC_UNMAP_THRESHOLD): Update documentation.
* doc/README.macros (MUNMAP_THRESHOLD): Likewise.
* include/private/gcconfig.h [USE_MUNMAP && !MUNMAP_THRESHOLD
&& (SN_TARGET_PS3 || SN_TARGET_PSP2 || MSWIN_XBOX1)]
(MUNMAP_THRESHOLD): Change value from 2 to 3.
Diffstat (limited to 'allchblk.c')
-rw-r--r-- | allchblk.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -402,7 +402,7 @@ STATIC void GC_add_to_fl(struct hblk *h, hdr *hhdr) #ifdef USE_MUNMAP # ifndef MUNMAP_THRESHOLD -# define MUNMAP_THRESHOLD 6 +# define MUNMAP_THRESHOLD 7 # endif GC_INNER int GC_unmap_threshold = MUNMAP_THRESHOLD; @@ -484,10 +484,10 @@ GC_INNER void GC_unmap_old(void) hhdr = HDR(h); if (!IS_MAPPED(hhdr)) continue; - /* Check that the interval is larger than the threshold (the */ - /* truncated counter value wrapping is handled correctly). */ - if ((unsigned short)(GC_gc_no - hhdr->hb_last_reclaimed) > - (unsigned short)GC_unmap_threshold) { + /* Check that the interval is not smaller than the threshold. */ + /* The truncated counter value wrapping is handled correctly. */ + if ((unsigned short)(GC_gc_no - hhdr->hb_last_reclaimed) + >= (unsigned short)GC_unmap_threshold) { # ifdef COUNT_UNMAPPED_REGIONS /* Continue with unmapping the block only if it will not */ /* create too many unmapped regions, or if unmapping */ |