Re: DSA failed to allocate memory
Dongming Liu <ldming101@gmail.com>
From: Dongming Liu <ldming101@gmail.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2022-03-18T07:30:49Z
Lists: pgsql-hackers
Attachments
- 0001-port-test_dsa.patch (application/octet-stream) patch 0001
- 0001-Re-bin-segment-when-dsa-memory-is-freed.patch (application/octet-stream) patch 0001
> > So it's OK for a segment to be in a bin that suggests that it has more > consecutive free pages than it really does. But it's NOT ok for a > segment to be in a bin that suggests it has fewer consecutive pages > than it really does. If dsa_free() is putting things back into the > wrong place, that's what we need to fix. I'm trying to move segments into appropriate bins in dsa_free(). In 0001-Re-bin-segment-when-dsa-memory-is-freed.patch, I extract the re-bin segment logic into a separate function called rebin_segment, call it to move the segment to the appropriate bin when dsa memory is freed. Otherwise, when allocating memory, due to the segment with enough contiguous pages is in a smaller bin, a suitable segment may not be found to allocate memory. Fot test, I port the test_dsa patch from [1] and add an OOM case to test memory allocation until OOM, free and then allocation, compare the number of allocated memory before and after. Any thoughts? [1] https://www.postgresql.org/message-id/CAEepm%3D3U7%2BRo7%3DECeQuAZoeFXs8iDVX56NXGCV7z3%3D%2BH%2BWd0Sw%40mail.gmail.com
Commits
-
Re-bin segment when memory pages are freed.
- 1605623ec686 11.21 landed
- 74ad9b0d1e7c 12.16 landed
- a0003572f214 13.12 landed
- b7ec66731dd8 14.9 landed
- 9ffb10f183f1 15.4 landed
- af8f9ec66bd1 16.0 landed
- 03f80daac8cf 17.0 landed
-
De-support floating-point timestamps.
- b6aa17e0ae36 10.0 cited