https://github.com/postgres/postgres
Revision af8f9ec66bd19a920d02b4c0eb65b3dd6057d324 authored by Thomas Munro on 04 July 2023, 03:16:34 UTC, committed by Thomas Munro on 04 July 2023, 03:21:36 UTC
It's OK to be lazy about re-binning memory segments when allocating,
because that can only leave segments in a bin that's too high.  We'll
search higher bins if necessary while allocating next time, and
also eventually re-bin, so no memory can become unreachable that way.

However, when freeing memory, the largest contiguous range of free pages
might go up, so we should re-bin eagerly to make sure we don't leave the
segment in a bin that is too low for get_best_segment() to find.

The re-binning code is moved into a function of its own, so it can be
called whenever free pages are returned to the segment's free page map.

Back-patch to all supported releases.

Author: Dongming Liu <ldming101@gmail.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com> (earlier version)
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>
Discussion: https://postgr.es/m/CAL1p7e8LzB2LSeAXo2pXCW4%2BRya9s0sJ3G_ReKOU%3DAjSUWjHWQ%40mail.gmail.com
1 parent 1252902
History
Tip revision: af8f9ec66bd19a920d02b4c0eb65b3dd6057d324 authored by Thomas Munro on 04 July 2023, 03:16:34 UTC
Re-bin segment when memory pages are freed.
Tip revision: af8f9ec
File Mode Size
config
contrib
doc
src
.cirrus.yml -rw-r--r-- 24.3 KB
.dir-locals.el -rw-r--r-- 730 bytes
.editorconfig -rw-r--r-- 183 bytes
.git-blame-ignore-revs -rw-r--r-- 10.2 KB
.gitattributes -rw-r--r-- 1.5 KB
.gitignore -rw-r--r-- 674 bytes
COPYRIGHT -rw-r--r-- 1.2 KB
GNUmakefile.in -rw-r--r-- 4.2 KB
HISTORY -rw-r--r-- 277 bytes
Makefile -rw-r--r-- 1.8 KB
README -rw-r--r-- 1.2 KB
README.git -rw-r--r-- 721 bytes
aclocal.m4 -rw-r--r-- 365 bytes
configure -rwxr-xr-x 570.5 KB
configure.ac -rw-r--r-- 85.1 KB
meson.build -rw-r--r-- 99.6 KB
meson_options.txt -rw-r--r-- 6.1 KB

README

back to top